issue #2329: update the prompt's format

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
This commit is contained in:
nilvng 2024-12-06 18:49:43 +11:00
parent 12479e3072
commit eced54c904
2 changed files with 3 additions and 3 deletions

View file

@ -340,7 +340,7 @@ func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shar
func promptForPR(prompter shared.Prompter, cs *iostreams.ColorScheme, jobs api.PullRequestAndTotalCount) (*api.PullRequest, error) {
candidates := []string{}
for _, pr := range jobs.PullRequests {
candidates = append(candidates, text.Truncate(120, fmt.Sprintf("%s %s (%s)",
candidates = append(candidates, text.Truncate(120, fmt.Sprintf("%s %s [%s]",
shared.PRNumberWithColor(cs, pr),
text.RemoveExcessiveWhitespace(pr.Title),
cs.Gray(pr.HeadLabel()),

View file

@ -239,9 +239,9 @@ func Test_checkoutRun(t *testing.T) {
},
promptStubs: func(pm *prompter.MockPrompter) {
pm.RegisterSelect("Select a pull request",
[]string{"#32 New feature (feature)", "#29 Fixed bad bug (bug-fix)", "#28 Improve documentation (docs)"},
[]string{"#32 New feature [feature]", "#29 Fixed bad bug [bug-fix]", "#28 Improve documentation [docs]"},
func(_, _ string, opts []string) (int, error) {
return prompter.IndexFor(opts, "#32 New feature (feature)")
return prompter.IndexFor(opts, "#32 New feature [feature]")
})
},
runStubs: func(cs *run.CommandStubber) {