diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-23 19:20:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 19:20:45 +0100 |
commit | 8ef6438fb476e9d510a39ead321cbeee6288e2d2 (patch) | |
tree | 2bcd2a5420bbdbed13b3de82992c30b7d17893e2 /input/prompt.go | |
parent | 0e68c10ffc3f9e72e32b8cdfcd917b3fe1ab240c (diff) | |
parent | 0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6 (diff) | |
download | git-bug-8ef6438fb476e9d510a39ead321cbeee6288e2d2.tar.gz |
Merge pull request #341 from MichaelMure/bridges-default-login
bridge: record the login used during the configure and use it as default credential
Diffstat (limited to 'input/prompt.go')
-rw-r--r-- | input/prompt.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/input/prompt.go b/input/prompt.go index 12aa7b92..80f5a614 100644 --- a/input/prompt.go +++ b/input/prompt.go @@ -48,10 +48,12 @@ func IsURL(name string, value string) (string, error) { // Prompts +// Prompt is a simple text input. func Prompt(prompt, name string, validators ...PromptValidator) (string, error) { return PromptDefault(prompt, name, "", validators...) } +// PromptDefault is a simple text input with a default value. func PromptDefault(prompt, name, preValue string, validators ...PromptValidator) (string, error) { loop: for { @@ -87,6 +89,7 @@ loop: } } +// PromptPassword is a specialized text input that doesn't display the characters entered. func PromptPassword(prompt, name string, validators ...PromptValidator) (string, error) { termState, err := terminal.GetState(syscall.Stdin) if err != nil { @@ -128,6 +131,8 @@ loop: } } +// PromptChoice is a prompt giving possible choices +// Return the index starting at zero of the choice selected. func PromptChoice(prompt string, choices []string) (int, error) { for { for i, choice := range choices { |