From 4bc90101cd11ccf7a4e8a26c014d2f759dfc7108 Mon Sep 17 00:00:00 2001 From: nilvng Date: Mon, 9 Dec 2024 21:20:07 +1100 Subject: [PATCH] issue #2329: fix prompt header getting duplicated following the approach in gh run view seems to fix this issue --- pkg/cmd/pr/checkout/checkout.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/pr/checkout/checkout.go b/pkg/cmd/pr/checkout/checkout.go index e60658955..71af45dda 100644 --- a/pkg/cmd/pr/checkout/checkout.go +++ b/pkg/cmd/pr/checkout/checkout.go @@ -102,7 +102,7 @@ func checkoutRun(opts *CheckoutOptions) error { return err } - pr, err := resolvePR(client, baseRepo, opts.Prompter, opts.SelectorArg, opts.Interactive, opts.Finder) + pr, err := resolvePR(client, baseRepo, opts.Prompter, opts.SelectorArg, opts.Interactive, opts.Finder, opts.IO) if err != nil { return err } @@ -291,7 +291,7 @@ func executeCmds(client *git.Client, credentialPattern git.CredentialPattern, cm return nil } -func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shared.Prompter, pullRequestSelector string, isInteractive bool, pullRequestFinder shared.PRFinder) (*api.PullRequest, error) { +func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shared.Prompter, pullRequestSelector string, isInteractive bool, pullRequestFinder shared.PRFinder, io *iostreams.IOStreams) (*api.PullRequest, error) { // When non-interactive if pullRequestSelector != "" { pr, _, err := pullRequestFinder.Find(shared.FindOptions{ @@ -314,6 +314,7 @@ func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shar return nil, cmdutil.FlagErrorf("pull request number, URL, or branch required when not running interactively") } // When interactive + io.StartProgressIndicator() listResult, err := list.ListPullRequests(httpClient, baseRepo, shared.FilterOptions{Entity: "pr", State: "open", Fields: []string{ "number", "title", @@ -328,6 +329,7 @@ func resolvePR(httpClient *http.Client, baseRepo ghrepo.Interface, prompter shar "isCrossRepository", "maintainerCanModify", }}, 10) + io.StopProgressIndicator() if err != nil { return nil, err }