From 6fd17ec2d212d046c16f2f70763043bf095b1425 Mon Sep 17 00:00:00 2001 From: nate smith Date: Mon, 10 Apr 2023 16:43:31 -0700 Subject: [PATCH] delete PromptForRun --- pkg/cmd/run/shared/shared.go | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/pkg/cmd/run/shared/shared.go b/pkg/cmd/run/shared/shared.go index 8cdd42f87..0f3a8fca8 100644 --- a/pkg/cmd/run/shared/shared.go +++ b/pkg/cmd/run/shared/shared.go @@ -9,12 +9,10 @@ import ( "strings" "time" - "github.com/AlecAivazis/survey/v2" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" workflowShared "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/iostreams" - "github.com/cli/cli/v2/pkg/prompt" ) type Prompter interface { @@ -467,36 +465,6 @@ func SelectRun(p Prompter, cs *iostreams.ColorScheme, runs []Run) (string, error return fmt.Sprintf("%d", runs[selected].ID), nil } -// TODO: this should be deprecated in favor of SelectRun -func PromptForRun(cs *iostreams.ColorScheme, runs []Run) (string, error) { - var selected int - now := time.Now() - - candidates := []string{} - - for _, run := range runs { - symbol, _ := Symbol(cs, run.Status, run.Conclusion) - candidates = append(candidates, - // TODO truncate commit message, long ones look terrible - fmt.Sprintf("%s %s, %s (%s) %s", symbol, run.Title(), run.WorkflowName(), run.HeadBranch, preciseAgo(now, run.StartedTime()))) - } - - // TODO consider custom filter so it's fuzzier. right now matches start anywhere in string but - // become contiguous - //nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter - err := prompt.SurveyAskOne(&survey.Select{ - Message: "Select a workflow run", - Options: candidates, - PageSize: 10, - }, &selected) - - if err != nil { - return "", err - } - - return fmt.Sprintf("%d", runs[selected].ID), nil -} - func GetRun(client *api.Client, repo ghrepo.Interface, runID string, attempt uint64) (*Run, error) { var result Run