Skip to content

Commit c70756d

Browse files
eddumelendezmislav
andauthored
Improve message when draft pr is created (cli#1202)
Fixes cli#1199 Co-authored-by: Mislav Marohnić <mislav@github.com>
1 parent aabf34d commit c70756d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

command/pr_create.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,18 @@ func prCreate(cmd *cobra.Command, _ []string) error {
192192
}
193193
}
194194

195+
isDraft, err := cmd.Flags().GetBool("draft")
196+
if err != nil {
197+
return fmt.Errorf("could not parse draft: %w", err)
198+
}
199+
195200
if !isWeb && !autofill {
196-
fmt.Fprintf(colorableErr(cmd), "\nCreating pull request for %s into %s in %s\n\n",
201+
message := "\nCreating pull request for %s into %s in %s\n\n"
202+
if isDraft {
203+
message = "\nCreating draft pull request for %s into %s in %s\n\n"
204+
}
205+
206+
fmt.Fprintf(colorableErr(cmd), message,
197207
utils.Cyan(headBranch),
198208
utils.Cyan(baseBranch),
199209
ghrepo.FullName(baseRepo))
@@ -245,10 +255,6 @@ func prCreate(cmd *cobra.Command, _ []string) error {
245255
return errors.New("pull request title must not be blank")
246256
}
247257

248-
isDraft, err := cmd.Flags().GetBool("draft")
249-
if err != nil {
250-
return fmt.Errorf("could not parse draft: %w", err)
251-
}
252258
if isDraft && isWeb {
253259
return errors.New("the --draft flag is not supported with --web")
254260
}

0 commit comments

Comments
 (0)