Add handling of empty titles for Issues and PRs

Currently, the prompter doesn't enforce the requirement of a title for PR
and Issue creation. However, that creates the UX where a user can enter a
blank title, spend time filling out a detailed body, then fail to create
the issue or pr when the request is sent to the api because the title is
blank. This attempts to handle that before sending a request to the api,
enforcing that, when prompting, the title of an issue is not blank.
This commit is contained in:
Tyler McGoffin 2024-10-04 10:08:48 -07:00
parent d645fd4f00
commit 5fc311374a

View file

@ -111,9 +111,16 @@ func BodySurvey(p Prompt, state *IssueMetadataState, templateContent string) err
}
func TitleSurvey(p Prompt, state *IssueMetadataState) error {
result, err := p.Input("Title", state.Title)
if err != nil {
return err
var err error
result := ""
for result == "" {
result, err = p.Input("Title (required)", state.Title)
if err != nil {
return err
}
if result == "" {
fmt.Println("X Title cannot be blank.")
}
}
if result != state.Title {