aboutsummaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-23 14:05:03 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-23 14:20:54 +0100
commit0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6 (patch)
tree6c488eef7d39ffcf9226cb1952460b44920ed39e /input
parentb3318335986618388637a9d35d68b39633e4548a (diff)
downloadgit-bug-0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6.tar.gz
bridge: record the login used during the configure and use it as default credential
fix #338
Diffstat (limited to 'input')
-rw-r--r--input/prompt.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/input/prompt.go b/input/prompt.go
index bd3fe4f0..f663780d 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 {