fix: tab format may break checkout prompts

This commit is contained in:
nilvng 2024-12-15 13:55:47 +11:00
parent 1f525bf175
commit d7cabf18f7
2 changed files with 3 additions and 3 deletions

View file

@ -344,7 +344,7 @@ func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shar
func promptForPR(prompter shared.Prompter, jobs api.PullRequestAndTotalCount) (*api.PullRequest, error) {
candidates := []string{}
for _, pr := range jobs.PullRequests {
candidates = append(candidates, fmt.Sprintf("%d\t%s\t%s [%s]",
candidates = append(candidates, fmt.Sprintf("%d\t%s %s [%s]",
pr.Number,
shared.PrStateWithDraft(&pr),
text.RemoveExcessiveWhitespace(pr.Title),

View file

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