Set default value for all Select prompts (#6131)
This commit is contained in:
parent
9af193029b
commit
6955db471d
4 changed files with 19 additions and 18 deletions
|
|
@ -187,13 +187,11 @@ func loginRun(opts *LoginOptions) error {
|
|||
}
|
||||
|
||||
func promptForHostname(opts *LoginOptions) (string, error) {
|
||||
options := []string{"GitHub.com", "GitHub Enterprise Server"}
|
||||
hostType, err := opts.Prompter.Select(
|
||||
"What account do you want to log into?",
|
||||
"",
|
||||
[]string{
|
||||
"GitHub.com",
|
||||
"GitHub Enterprise Server",
|
||||
})
|
||||
options[0],
|
||||
options)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ func Login(opts *LoginOptions) error {
|
|||
}
|
||||
result, err := opts.Prompter.Select(
|
||||
"What is your preferred protocol for Git operations?",
|
||||
"", options)
|
||||
options[0],
|
||||
options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -82,7 +83,8 @@ func Login(opts *LoginOptions) error {
|
|||
if len(pubKeys) > 0 {
|
||||
options := append(pubKeys, "Skip")
|
||||
keyChoice, err := opts.Prompter.Select(
|
||||
"Upload your SSH public key to your GitHub account?", "",
|
||||
"Upload your SSH public key to your GitHub account?",
|
||||
options[0],
|
||||
options)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -126,12 +128,12 @@ func Login(opts *LoginOptions) error {
|
|||
if opts.Web {
|
||||
authMode = 0
|
||||
} else if opts.Interactive {
|
||||
options := []string{"Login with a web browser", "Paste an authentication token"}
|
||||
var err error
|
||||
authMode, err = opts.Prompter.Select(
|
||||
"How would you like to authenticate GitHub CLI?", "",
|
||||
[]string{
|
||||
"Login with a web browser",
|
||||
"Paste an authentication token"})
|
||||
"How would you like to authenticate GitHub CLI?",
|
||||
options[0],
|
||||
options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,11 +247,10 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command {
|
|||
if err != nil {
|
||||
return extName, -1, err
|
||||
}
|
||||
extTmplType, err := prompter.Select("What kind of extension?", "", []string{
|
||||
"Script (Bash, Ruby, Python, etc)",
|
||||
"Go",
|
||||
"Other Precompiled (C++, Rust, etc)",
|
||||
})
|
||||
options := []string{"Script (Bash, Ruby, Python, etc)", "Go", "Other Precompiled (C++, Rust, etc)"}
|
||||
extTmplType, err := prompter.Select("What kind of extension?",
|
||||
options[0],
|
||||
options)
|
||||
return extName, extensions.ExtTemplateType(extTmplType), err
|
||||
}
|
||||
var flagType string
|
||||
|
|
|
|||
|
|
@ -205,9 +205,11 @@ func reviewRun(opts *ReviewOptions) error {
|
|||
}
|
||||
|
||||
func reviewSurvey(opts *ReviewOptions, editorCommand string) (*api.PullRequestReviewInput, error) {
|
||||
options := []string{"Comment", "Approve", "Request Changes"}
|
||||
reviewType, err := opts.Prompter.Select(
|
||||
"What kind of review do you want to give?", "",
|
||||
[]string{"Comment", "Approve", "Request Changes"})
|
||||
"What kind of review do you want to give?",
|
||||
options[0],
|
||||
options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue