Skip to content

Commit

Permalink
Merge pull request cli#497 from ShahzadUmair/fix-template
Browse files Browse the repository at this point in the history
Explicitly replace empty body with default template
  • Loading branch information
mislav authored Feb 19, 2020
2 parents f6856d9 + 12216fe commit f6c9e7b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion command/title_body_survey.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ func selectTemplate(templatePaths []string) (string, error) {

func titleBodySurvey(cmd *cobra.Command, providedTitle string, providedBody string, templatePaths []string) (*titleBody, error) {
inProgress := titleBody{}
templateContents := ""

if providedBody == "" && len(templatePaths) > 0 {
templateContents, err := selectTemplate(templatePaths)
var err error
templateContents, err = selectTemplate(templatePaths)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -121,6 +123,10 @@ func titleBodySurvey(cmd *cobra.Command, providedTitle string, providedBody stri
return nil, fmt.Errorf("could not prompt: %w", err)
}

if inProgress.Body == "" {
inProgress.Body = templateContents
}

confirmA, err := confirm()
if err != nil {
return nil, fmt.Errorf("unable to confirm: %w", err)
Expand Down

0 comments on commit f6c9e7b

Please sign in to comment.