Improve message when draft pr is created (#1202)

Fixes #1199

Co-authored-by: Mislav Marohnić <mislav@github.com>
This commit is contained in:
Eddú Meléndez Gonzales 2020-06-15 08:27:30 -05:00 committed by GitHub
parent aabf34d092
commit c70756d596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,8 +192,18 @@ func prCreate(cmd *cobra.Command, _ []string) error {
}
}
isDraft, err := cmd.Flags().GetBool("draft")
if err != nil {
return fmt.Errorf("could not parse draft: %w", err)
}
if !isWeb && !autofill {
fmt.Fprintf(colorableErr(cmd), "\nCreating pull request for %s into %s in %s\n\n",
message := "\nCreating pull request for %s into %s in %s\n\n"
if isDraft {
message = "\nCreating draft pull request for %s into %s in %s\n\n"
}
fmt.Fprintf(colorableErr(cmd), message,
utils.Cyan(headBranch),
utils.Cyan(baseBranch),
ghrepo.FullName(baseRepo))
@ -245,10 +255,6 @@ func prCreate(cmd *cobra.Command, _ []string) error {
return errors.New("pull request title must not be blank")
}
isDraft, err := cmd.Flags().GetBool("draft")
if err != nil {
return fmt.Errorf("could not parse draft: %w", err)
}
if isDraft && isWeb {
return errors.New("the --draft flag is not supported with --web")
}