fix linting
This commit is contained in:
parent
d5334f4115
commit
41385477c3
44 changed files with 98 additions and 0 deletions
|
|
@ -119,6 +119,7 @@ func (r *ResolvedRemotes) BaseRepo(io *iostreams.IOStreams) (ghrepo.Interface, e
|
|||
// hide the spinner in case a command started the progress indicator before base repo was fully
|
||||
// resolved, e.g. in `gh issue view`
|
||||
io.StopProgressIndicator()
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "Which should be the base repository (used for e.g. querying issues) for this directory?",
|
||||
Options: repoNames,
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ func logoutRun(opts *LogoutOptions) error {
|
|||
if len(candidates) == 1 {
|
||||
hostname = candidates[0]
|
||||
} else {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "What account do you want to log out of?",
|
||||
Options: candidates,
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ func Test_logoutRun_tty(t *testing.T) {
|
|||
return &http.Client{Transport: reg}, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ func refreshRun(opts *RefreshOptions) error {
|
|||
if len(candidates) == 1 {
|
||||
hostname = candidates[0]
|
||||
} else {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "What account do you want to refresh auth for?",
|
||||
Options: candidates,
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ func Test_refreshRun(t *testing.T) {
|
|||
)
|
||||
tt.opts.httpClient = &http.Client{Transport: httpReg}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ func editRun(opts *EditOptions) error {
|
|||
if !opts.IO.CanPrompt() {
|
||||
return errors.New("unsure what file to edit; either specify --filename or run interactively")
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "Edit which file?",
|
||||
Options: candidates,
|
||||
|
|
@ -249,6 +250,7 @@ func editRun(opts *EditOptions) error {
|
|||
|
||||
choice := ""
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "What next?",
|
||||
Options: []string{
|
||||
|
|
|
|||
|
|
@ -486,6 +486,7 @@ func Test_editRun(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ func promptGists(client *http.Client, host string, cs *iostreams.ColorScheme) (g
|
|||
Options: opts,
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(questions, &result)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -355,6 +355,7 @@ func Test_viewRun(t *testing.T) {
|
|||
)),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Select a gist").AnswerDefault()
|
||||
}
|
||||
|
|
@ -469,6 +470,7 @@ func Test_promptGists(t *testing.T) {
|
|||
client := &http.Client{Transport: reg}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ func TestIssueCreate_recover(t *testing.T) {
|
|||
assert.Equal(t, []interface{}{"BUGID", "TODOID"}, inputs["labelIds"])
|
||||
}))
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
as.StubPrompt("Title").AnswerDefault()
|
||||
|
|
@ -469,6 +470,7 @@ func TestIssueCreate_nonLegacyTemplate(t *testing.T) {
|
|||
}),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
as.StubPrompt("Choose a template").AnswerWith("Submit a request")
|
||||
|
|
@ -499,6 +501,7 @@ func TestIssueCreate_continueInBrowser(t *testing.T) {
|
|||
} } }`),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
as.StubPrompt("Title").AnswerWith("hello")
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ func deleteRun(opts *DeleteOptions) error {
|
|||
// already provided. Otherwise skip confirmation.
|
||||
if opts.IO.CanPrompt() && !opts.Confirmed {
|
||||
answer := ""
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(
|
||||
&survey.Input{
|
||||
Message: fmt.Sprintf("You're going to delete issue #%d. This action cannot be reversed. To confirm, type the issue number:", issue.Number),
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ func TestIssueDelete(t *testing.T) {
|
|||
}),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("You're going to delete issue #13. This action cannot be reversed. To confirm, type the issue number:").AnswerWith("13")
|
||||
|
||||
|
|
@ -136,6 +137,7 @@ func TestIssueDelete_cancel(t *testing.T) {
|
|||
} } }`),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("You're going to delete issue #13. This action cannot be reversed. To confirm, type the issue number:").AnswerWith("14")
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ func deleteRun(opts *deleteOptions) error {
|
|||
|
||||
if !opts.Confirmed {
|
||||
var valid string
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(
|
||||
&survey.Input{Message: fmt.Sprintf("Type %s to confirm deletion:", opts.Name)},
|
||||
&valid,
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ func TestDeleteRun(t *testing.T) {
|
|||
return &http.Client{Transport: reg}, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -569,6 +569,7 @@ func NewCreateContext(opts *CreateOptions) (*CreateContext, error) {
|
|||
pushOptions = append(pushOptions, "Cancel")
|
||||
|
||||
var selectedOption int
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Select{
|
||||
Message: fmt.Sprintf("Where should we push the '%s' branch?", headBranch),
|
||||
Options: pushOptions,
|
||||
|
|
|
|||
|
|
@ -654,6 +654,7 @@ func TestPRCreate_nonLegacyTemplate(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "1234567890,commit 0\n2345678901,commit 1")
|
||||
cs.Register(`git status --porcelain`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
as.StubPrompt("Choose a template").
|
||||
|
|
@ -916,6 +917,7 @@ func TestPRCreate_draft(t *testing.T) {
|
|||
assert.Equal(t, true, input["draft"].(bool))
|
||||
}))
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
|
||||
as.StubPrompt("Choose a template").AnswerDefault()
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ func (m *mergeContext) deleteLocalBranch() error {
|
|||
if m.merged {
|
||||
// prompt for delete
|
||||
if m.opts.IO.CanPrompt() && !m.opts.IsDeleteBranchIndicated {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: fmt.Sprintf("Pull request #%d was already merged. Delete the branch locally?", m.pr.Number),
|
||||
Default: false,
|
||||
|
|
@ -571,6 +572,7 @@ func mergeMethodSurvey(baseRepo *api.Repository) (PullRequestMergeMethod, error)
|
|||
}
|
||||
|
||||
var result int
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(mergeQuestion, &result)
|
||||
return mergeOpts[result].method, err
|
||||
}
|
||||
|
|
@ -589,6 +591,7 @@ func deleteBranchSurvey(opts *MergeOptions, crossRepoPR, localBranchExists bool)
|
|||
Message: message,
|
||||
Default: false,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(submit, &result)
|
||||
return result, err
|
||||
}
|
||||
|
|
@ -615,6 +618,7 @@ func confirmSurvey(allowEditMsg bool) (shared.Action, error) {
|
|||
Message: "What's next?",
|
||||
Options: options,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(submit, &result)
|
||||
if err != nil {
|
||||
return shared.CancelAction, fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -960,6 +960,7 @@ func TestPrMerge_alreadyMerged(t *testing.T) {
|
|||
cs.Register(`git branch -D blueberries`, 0, "")
|
||||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Pull request #4 was already merged. Delete the branch locally?").AnswerWith(true)
|
||||
|
||||
|
|
@ -1021,6 +1022,7 @@ func TestPrMerge_alreadyMerged_withMergeStrategy_TTY(t *testing.T) {
|
|||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
cs.Register(`git branch -D `, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Pull request #4 was already merged. Delete the branch locally?").AnswerWith(true)
|
||||
|
||||
|
|
@ -1100,6 +1102,7 @@ func TestPRMergeTTY(t *testing.T) {
|
|||
|
||||
cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
|
|
@ -1161,6 +1164,7 @@ func TestPRMergeTTY_withDeleteBranch(t *testing.T) {
|
|||
cs.Register(`git branch -D blueberries`, 0, "")
|
||||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
as.StubPrompt("What's next?").AnswerWith("Submit")
|
||||
|
|
@ -1220,6 +1224,7 @@ func TestPRMergeTTY_squashEditCommitMsgAndSubject(t *testing.T) {
|
|||
_, cmdTeardown := run.Stub()
|
||||
defer cmdTeardown(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerWith("Squash and merge")
|
||||
as.StubPrompt("Delete the branch on GitHub?").AnswerDefault()
|
||||
|
|
@ -1298,6 +1303,7 @@ func TestPRTTY_cancelled(t *testing.T) {
|
|||
|
||||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
|
|
@ -1317,6 +1323,7 @@ func Test_mergeMethodSurvey(t *testing.T) {
|
|||
RebaseMergeAllowed: true,
|
||||
SquashMergeAllowed: true,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerWith("Rebase and merge")
|
||||
|
||||
|
|
@ -1624,6 +1631,7 @@ func TestPrAddToMergeQueueAdmin(t *testing.T) {
|
|||
defer cmdTeardown(t)
|
||||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("What merge method would you like to use?").AnswerDefault()
|
||||
as.StubPrompt("Delete the branch locally and on GitHub?").AnswerDefault()
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ func confirmSubmission(allowPreview, allowMetadata, allowDraft, isDraft bool) (A
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(confirmQs, &confirmAnswers)
|
||||
if err != nil {
|
||||
return -1, fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
@ -122,6 +123,7 @@ func BodySurvey(state *IssueMetadataState, templateContent, editorCommand string
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(qs, state)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -148,6 +150,7 @@ func TitleSurvey(state *IssueMetadataState) error {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(qs, state)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -197,6 +200,7 @@ func MetadataSurvey(io *iostreams.IOStreams, baseRepo ghrepo.Interface, fetcher
|
|||
}
|
||||
extraFieldsOptions = append(extraFieldsOptions, "Assignees", "Labels", "Projects", "Milestone")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk([]*survey.Question{
|
||||
{
|
||||
Name: "metadata",
|
||||
|
|
@ -327,6 +331,7 @@ func MetadataSurvey(io *iostreams.IOStreams, baseRepo ghrepo.Interface, fetcher
|
|||
Milestone string
|
||||
}{}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(mqs, &values)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ func (m *templateManager) Choose() (Template, error) {
|
|||
}
|
||||
|
||||
var selectedOption int
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "Choose a template",
|
||||
Options: append(names, blankOption),
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ func TestTemplateManager_hasAPI(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Choose a template").
|
||||
AssertOptions([]string{"Bug report", "Feature request", "Open a blank issue"}).
|
||||
|
|
@ -93,6 +94,7 @@ func TestTemplateManager_hasAPI_PullRequest(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Choose a template").
|
||||
AssertOptions([]string{"bug_pr.md", "feature_pr.md", "Open a blank pull request"}).
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ func createRun(opts *CreateOptions) error {
|
|||
Options: options,
|
||||
Default: options[0],
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(q, &tag)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
@ -209,6 +210,7 @@ func createRun(opts *CreateOptions) error {
|
|||
q := &survey.Input{
|
||||
Message: "Tag name",
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(q, &opts.TagName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
@ -309,6 +311,7 @@ func createRun(opts *CreateOptions) error {
|
|||
},
|
||||
},
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(qs, opts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
@ -373,6 +376,7 @@ func createRun(opts *CreateOptions) error {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(qs, opts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -851,6 +851,7 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ func deleteAssetRun(opts *DeleteAssetOptions) error {
|
|||
|
||||
if !opts.SkipConfirm && opts.IO.CanPrompt() {
|
||||
var confirmed bool
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: fmt.Sprintf("Delete asset %s in release %s in %s?", opts.AssetName, release.TagName, ghrepo.FullName(baseRepo)),
|
||||
Default: true,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ func deleteRun(opts *DeleteOptions) error {
|
|||
|
||||
if !opts.SkipConfirm && opts.IO.CanPrompt() {
|
||||
var confirmed bool
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: fmt.Sprintf("Delete release %s in %s?", release.TagName, ghrepo.FullName(baseRepo)),
|
||||
Default: true,
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ func archiveRun(opts *ArchiveOptions) error {
|
|||
Message: fmt.Sprintf("Archive %s?", fullName),
|
||||
Default: false,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(p, &opts.Confirmed)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ func createRun(opts *CreateOptions) error {
|
|||
"Create a new repository on GitHub from scratch",
|
||||
"Push an existing local repository to GitHub",
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
if err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "What would you like to do?",
|
||||
Options: modeOptions,
|
||||
|
|
@ -353,6 +354,7 @@ func createFromScratch(opts *CreateOptions) error {
|
|||
Message: "Clone the new repository locally?",
|
||||
Default: true,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(cloneQuestion, &opts.Clone)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -507,6 +509,7 @@ func createFromLocal(opts *CreateOptions) error {
|
|||
Message: `Add a remote?`,
|
||||
Default: true,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(remoteQuesiton, &addRemote)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -520,6 +523,7 @@ func createFromLocal(opts *CreateOptions) error {
|
|||
Message: "What should the new remote be called?",
|
||||
Default: "origin",
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(pushQuestion, &baseRemote)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -536,6 +540,7 @@ func createFromLocal(opts *CreateOptions) error {
|
|||
Message: fmt.Sprintf(`Would you like to push commits from the current branch to %q?`, baseRemote),
|
||||
Default: true,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(pushQuestion, &opts.Push)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -684,6 +689,7 @@ func interactiveGitIgnore(client *http.Client, hostname string) (string, error)
|
|||
}
|
||||
|
||||
addGitIgnoreSurvey = append(addGitIgnoreSurvey, addGitIgnoreQuestion)
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(addGitIgnoreSurvey, &addGitIgnore)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -706,6 +712,7 @@ func interactiveGitIgnore(client *http.Client, hostname string) (string, error)
|
|||
},
|
||||
}
|
||||
gitIg = append(gitIg, gitIgnoreQuestion)
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(gitIg, &wantedIgnoreTemplate)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -730,6 +737,7 @@ func interactiveLicense(client *http.Client, hostname string) (string, error) {
|
|||
}
|
||||
|
||||
addLicenseSurvey = append(addLicenseSurvey, addLicenseQuestion)
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(addLicenseSurvey, &addLicense)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -757,6 +765,7 @@ func interactiveLicense(client *http.Client, hostname string) (string, error) {
|
|||
},
|
||||
}
|
||||
licenseQs = append(licenseQs, licenseQuestion)
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(licenseQs, &wantedLicense)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -794,6 +803,7 @@ func interactiveRepoInfo(defaultName string) (string, string, string, error) {
|
|||
RepoVisibility string
|
||||
}{}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk(qs, &answer)
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
|
|
@ -808,6 +818,7 @@ func interactiveSource() (string, error) {
|
|||
Message: "Path to local repository",
|
||||
Default: "."}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(sourcePrompt, &sourcePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -823,6 +834,7 @@ func confirmSubmission(repoWithOwner, visibility string) error {
|
|||
var answer struct {
|
||||
ConfirmSubmit bool
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err := prompt.SurveyAsk([]*survey.Question{{
|
||||
Name: "confirmSubmit",
|
||||
Prompt: &survey.Confirm{
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ func interactiveChoice(r *api.Repository) ([]string, error) {
|
|||
options = append(options, optionAllowForking)
|
||||
}
|
||||
var answers []string
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.MultiSelect{
|
||||
Message: "What do you want to edit?",
|
||||
Options: options,
|
||||
|
|
@ -301,6 +302,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
switch c {
|
||||
case optionDescription:
|
||||
opts.Edits.Description = &r.Description
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Input{
|
||||
Message: "Description of the repository",
|
||||
Default: r.Description,
|
||||
|
|
@ -310,6 +312,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionHomePageURL:
|
||||
opts.Edits.Homepage = &r.HomepageURL
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Input{
|
||||
Message: "Repository home page URL",
|
||||
Default: r.HomepageURL,
|
||||
|
|
@ -319,6 +322,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionTopics:
|
||||
var addTopics string
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Input{
|
||||
Message: "Add topics?(csv format)",
|
||||
}, &addTopics)
|
||||
|
|
@ -330,6 +334,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
|
||||
if len(opts.topicsCache) > 0 {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.MultiSelect{
|
||||
Message: "Remove Topics",
|
||||
Options: opts.topicsCache,
|
||||
|
|
@ -340,6 +345,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionDefaultBranchName:
|
||||
opts.Edits.DefaultBranch = &r.DefaultBranchRef.Name
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Input{
|
||||
Message: "Default branch name",
|
||||
Default: r.DefaultBranchRef.Name,
|
||||
|
|
@ -349,6 +355,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionWikis:
|
||||
opts.Edits.EnableWiki = &r.HasWikiEnabled
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Enable Wikis?",
|
||||
Default: r.HasWikiEnabled,
|
||||
|
|
@ -358,6 +365,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionIssues:
|
||||
opts.Edits.EnableIssues = &r.HasIssuesEnabled
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Enable Issues?",
|
||||
Default: r.HasIssuesEnabled,
|
||||
|
|
@ -367,6 +375,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionProjects:
|
||||
opts.Edits.EnableProjects = &r.HasProjectsEnabled
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Enable Projects?",
|
||||
Default: r.HasProjectsEnabled,
|
||||
|
|
@ -376,6 +385,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionVisibility:
|
||||
opts.Edits.Visibility = &r.Visibility
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "Visibility",
|
||||
Options: []string{"public", "private", "internal"},
|
||||
|
|
@ -396,6 +406,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
if r.RebaseMergeAllowed {
|
||||
defaultMergeOptions = append(defaultMergeOptions, allowRebaseMerge)
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.MultiSelect{
|
||||
Message: "Allowed merge strategies",
|
||||
Default: defaultMergeOptions,
|
||||
|
|
@ -415,6 +426,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
|
||||
opts.Edits.EnableAutoMerge = &r.AutoMergeAllowed
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Enable Auto Merge?",
|
||||
Default: r.AutoMergeAllowed,
|
||||
|
|
@ -424,6 +436,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
|
||||
opts.Edits.DeleteBranchOnMerge = &r.DeleteBranchOnMerge
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Automatically delete head branches after merging?",
|
||||
Default: r.DeleteBranchOnMerge,
|
||||
|
|
@ -433,6 +446,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionTemplateRepo:
|
||||
opts.Edits.IsTemplate = &r.IsTemplate
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Convert into a template repository?",
|
||||
Default: r.IsTemplate,
|
||||
|
|
@ -442,6 +456,7 @@ func interactiveRepoEdit(opts *EditOptions, r *api.Repository) error {
|
|||
}
|
||||
case optionAllowForking:
|
||||
opts.Edits.AllowForking = &r.ForkingAllowed
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(&survey.Confirm{
|
||||
Message: "Allow forking (of an organization repository)?",
|
||||
Default: r.ForkingAllowed,
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ func Test_editRun_interactive(t *testing.T) {
|
|||
opts := &tt.opts
|
||||
opts.HTTPClient = &http.Client{Transport: httpReg}
|
||||
opts.IO = ios
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -260,6 +260,7 @@ func forkRun(opts *ForkOptions) error {
|
|||
|
||||
remoteDesired := opts.Remote
|
||||
if opts.PromptRemote {
|
||||
//nolint:staticcheck // SA1019: prompt.Confirm is deprecated: use Prompter
|
||||
err = prompt.Confirm("Would you like to add a remote for the fork?", &remoteDesired)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prompt: %w", err)
|
||||
|
|
@ -302,6 +303,7 @@ func forkRun(opts *ForkOptions) error {
|
|||
} else {
|
||||
cloneDesired := opts.Clone
|
||||
if opts.PromptClone {
|
||||
//nolint:staticcheck // SA1019: prompt.Confirm is deprecated: use Prompter
|
||||
err = prompt.Confirm("Would you like to clone the fork?", &cloneDesired)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ func renameRun(opts *RenameOptions) error {
|
|||
}
|
||||
|
||||
if newRepoName == "" {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(
|
||||
&survey.Input{
|
||||
Message: fmt.Sprintf("Rename %s to: ", ghrepo.FullName(currRepo)),
|
||||
|
|
@ -106,6 +107,7 @@ func renameRun(opts *RenameOptions) error {
|
|||
Message: fmt.Sprintf("Rename %s to %s?", ghrepo.FullName(currRepo), newRepoName),
|
||||
Default: false,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err = prompt.SurveyAskOne(p, &confirmed)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prompt: %w", err)
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ func matchAnyPattern(patterns []string, name string) bool {
|
|||
type surveyPrompter struct{}
|
||||
|
||||
func (sp *surveyPrompter) Prompt(message string, options []string, result interface{}) error {
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
return prompt.SurveyAskOne(&survey.MultiSelect{
|
||||
Message: message,
|
||||
Options: options,
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ func PromptForRun(cs *iostreams.ColorScheme, runs []Run) (string, error) {
|
|||
|
||||
// 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,
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ func promptForJob(cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, er
|
|||
}
|
||||
|
||||
var selected int
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: "View a specific job in this run?",
|
||||
Options: candidates,
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ func TestWatchRun(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -373,6 +373,7 @@ func getBody(opts *SetOptions) ([]byte, error) {
|
|||
|
||||
if opts.IO.CanPrompt() {
|
||||
var bodyInput string
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Password{
|
||||
Message: "Paste your secret",
|
||||
}, &bodyInput)
|
||||
|
|
|
|||
|
|
@ -560,6 +560,7 @@ func Test_getBodyPrompt(t *testing.T) {
|
|||
ios.SetStdinTTY(true)
|
||||
ios.SetStdoutTTY(true)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
as.StubPrompt("Paste your secret").AnswerWith("cool secret")
|
||||
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ func TestDisableRun(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -327,6 +327,7 @@ func TestEnableRun(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ func collectInputs(yamlContent []byte) (map[string]string, error) {
|
|||
inputAnswer := InputAnswer{
|
||||
providedInputs: providedInputs,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAsk is deprecated: use Prompter
|
||||
err = prompt.SurveyAsk(qs, &inputAnswer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -632,6 +632,7 @@ jobs:
|
|||
}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
//nolint:staticcheck // SA1019: prompt.NewAskStubber is deprecated: use PrompterMock
|
||||
as := prompt.NewAskStubber(t)
|
||||
if tt.askStubs != nil {
|
||||
tt.askStubs(as)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ func SelectWorkflow(workflows []Workflow, promptMsg string, states []WorkflowSta
|
|||
|
||||
var selected int
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.SurveyAskOne is deprecated: use Prompter
|
||||
err := prompt.SurveyAskOne(&survey.Select{
|
||||
Message: promptMsg,
|
||||
Options: candidates,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package prompt
|
|||
|
||||
import "github.com/AlecAivazis/survey/v2"
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
func StubConfirm(result bool) func() {
|
||||
orig := Confirm
|
||||
Confirm = func(_ string, r *bool) error {
|
||||
|
|
@ -13,6 +14,7 @@ func StubConfirm(result bool) func() {
|
|||
}
|
||||
}
|
||||
|
||||
// Deprecated: use Prompter
|
||||
var Confirm = func(prompt string, result *bool) error {
|
||||
p := &survey.Confirm{
|
||||
Message: prompt,
|
||||
|
|
@ -21,10 +23,12 @@ var Confirm = func(prompt string, result *bool) error {
|
|||
return SurveyAskOne(p, result)
|
||||
}
|
||||
|
||||
// Deprecated: use Prompter
|
||||
var SurveyAskOne = func(p survey.Prompt, response interface{}, opts ...survey.AskOpt) error {
|
||||
return survey.AskOne(p, response, opts...)
|
||||
}
|
||||
|
||||
// Deprecated: use Prompter
|
||||
var SurveyAsk = func(qs []*survey.Question, response interface{}, opts ...survey.AskOpt) error {
|
||||
return survey.Ask(qs, response, opts...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ type testing interface {
|
|||
Cleanup(func())
|
||||
}
|
||||
|
||||
// Deprecated: use PrompterMock
|
||||
func NewAskStubber(t testing) *AskStubber {
|
||||
as, teardown := InitAskStubber()
|
||||
t.Cleanup(func() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue