Skip to content

Commit

Permalink
pr create: add change title
Browse files Browse the repository at this point in the history
  • Loading branch information
craftamap committed Jan 8, 2021
1 parent dfaef9c commit 64dd7e5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cmd/commands/pr/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@ func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
selectNext := &survey.Select{
Message: "What's next?",
Options: []string{
"create", "modify body", "change destination branch", "manage reviewers", "cancel",
"create",
"modify title",
"modify body",
"change destination branch",
"manage reviewers",
"cancel",
},
Default: "create",
}
Expand All @@ -218,6 +223,20 @@ func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
break
}

if doNext == "modify title" {
questionTitle := &survey.Input{
Message: "Title",
Default: title,
}
err = survey.AskOne(questionTitle, &title)
if err != nil {
fmt.Printf("%s%s%s\n", aurora.Red(":: "), aurora.Bold("An error occurred: "), err)
return
}
fmt.Println(aurora.Bold(aurora.Green("!").String()+" Title:"), title)
continue
}

if doNext == "modify body" {
body, err = surveyext.Edit("vim", "", body, os.Stdin, os.Stdout, os.Stderr, nil)
if err != nil {
Expand Down

0 comments on commit 64dd7e5

Please # to comment.