|
7 | 7 | "github.com/cli/cli/api" |
8 | 8 | "github.com/cli/cli/internal/ghrepo" |
9 | 9 | "github.com/cli/cli/pkg/githubtemplate" |
| 10 | + "github.com/cli/cli/pkg/prompt" |
10 | 11 | "github.com/cli/cli/pkg/surveyext" |
11 | 12 | "github.com/cli/cli/utils" |
12 | 13 | "github.com/spf13/cobra" |
@@ -54,10 +55,6 @@ const ( |
54 | 55 | noMilestone = "(none)" |
55 | 56 | ) |
56 | 57 |
|
57 | | -var SurveyAsk = func(qs []*survey.Question, response interface{}, opts ...survey.AskOpt) error { |
58 | | - return survey.Ask(qs, response, opts...) |
59 | | -} |
60 | | - |
61 | 58 | func confirmSubmission(allowPreview bool, allowMetadata bool) (Action, error) { |
62 | 59 | const ( |
63 | 60 | submitLabel = "Submit" |
@@ -88,7 +85,7 @@ func confirmSubmission(allowPreview bool, allowMetadata bool) (Action, error) { |
88 | 85 | }, |
89 | 86 | } |
90 | 87 |
|
91 | | - err := SurveyAsk(confirmQs, &confirmAnswers) |
| 88 | + err := prompt.SurveyAsk(confirmQs, &confirmAnswers) |
92 | 89 | if err != nil { |
93 | 90 | return -1, fmt.Errorf("could not prompt: %w", err) |
94 | 91 | } |
@@ -130,7 +127,7 @@ func selectTemplate(nonLegacyTemplatePaths []string, legacyTemplatePath *string, |
130 | 127 | }, |
131 | 128 | }, |
132 | 129 | } |
133 | | - if err := SurveyAsk(selectQs, &templateResponse); err != nil { |
| 130 | + if err := prompt.SurveyAsk(selectQs, &templateResponse); err != nil { |
134 | 131 | return "", fmt.Errorf("could not prompt: %w", err) |
135 | 132 | } |
136 | 133 |
|
@@ -201,7 +198,7 @@ func titleBodySurvey(cmd *cobra.Command, issueState *issueMetadataState, apiClie |
201 | 198 | qs = append(qs, bodyQuestion) |
202 | 199 | } |
203 | 200 |
|
204 | | - err = SurveyAsk(qs, issueState) |
| 201 | + err = prompt.SurveyAsk(qs, issueState) |
205 | 202 | if err != nil { |
206 | 203 | return fmt.Errorf("could not prompt: %w", err) |
207 | 204 | } |
@@ -232,7 +229,7 @@ func titleBodySurvey(cmd *cobra.Command, issueState *issueMetadataState, apiClie |
232 | 229 | } |
233 | 230 | extraFieldsOptions = append(extraFieldsOptions, "Assignees", "Labels", "Projects", "Milestone") |
234 | 231 |
|
235 | | - err = SurveyAsk([]*survey.Question{ |
| 232 | + err = prompt.SurveyAsk([]*survey.Question{ |
236 | 233 | { |
237 | 234 | Name: "metadata", |
238 | 235 | Prompt: &survey.MultiSelect{ |
@@ -364,7 +361,7 @@ func titleBodySurvey(cmd *cobra.Command, issueState *issueMetadataState, apiClie |
364 | 361 | } |
365 | 362 | } |
366 | 363 | values := metadataValues{} |
367 | | - err = SurveyAsk(mqs, &values, survey.WithKeepFilter(true)) |
| 364 | + err = prompt.SurveyAsk(mqs, &values, survey.WithKeepFilter(true)) |
368 | 365 | if err != nil { |
369 | 366 | return fmt.Errorf("could not prompt: %w", err) |
370 | 367 | } |
|
0 commit comments