From d7cabf18f7b805dec117f641e071c23247f64872 Mon Sep 17 00:00:00 2001 From: nilvng Date: Sun, 15 Dec 2024 13:55:47 +1100 Subject: [PATCH] fix: tab format may break checkout prompts --- pkg/cmd/pr/checkout/checkout.go | 2 +- pkg/cmd/pr/checkout/checkout_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/pr/checkout/checkout.go b/pkg/cmd/pr/checkout/checkout.go index 8df4a6faf..faf006c7e 100644 --- a/pkg/cmd/pr/checkout/checkout.go +++ b/pkg/cmd/pr/checkout/checkout.go @@ -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), diff --git a/pkg/cmd/pr/checkout/checkout_test.go b/pkg/cmd/pr/checkout/checkout_test.go index b1d70f68b..a099a848d 100644 --- a/pkg/cmd/pr/checkout/checkout_test.go +++ b/pkg/cmd/pr/checkout/checkout_test.go @@ -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) {