From a4e5035b99889c571abce1a836887434d73cd03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sat, 15 Feb 2020 15:58:31 +0100 Subject: [PATCH] prompt: minor fixes --- input/prompt.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/input/prompt.go b/input/prompt.go index b5ca9a178bacea311245ee3a44ca97f77c1c9b7f..bd3fe4f04a85ba67dff7739efe0bfeadce33f9ab 100644 --- a/input/prompt.go +++ b/input/prompt.go @@ -145,7 +145,7 @@ func PromptChoice(prompt string, choices []string) (int, error) { index, err := strconv.Atoi(line) if err != nil || index < 1 || index > len(choices) { - _, _ = fmt.Fprintf(os.Stderr, "invalid input") + _, _ = fmt.Fprintln(os.Stderr, "invalid input") continue } @@ -179,7 +179,7 @@ func PromptURLWithRemote(prompt, name string, validRemotes []string, validators index, err := strconv.Atoi(line) if err != nil || index < 0 || index > len(validRemotes) { - _, _ = fmt.Fprintf(os.Stderr, "invalid input") + _, _ = fmt.Fprintln(os.Stderr, "invalid input") continue } @@ -249,7 +249,7 @@ func PromptCredential(target, name string, credentials []auth.Credential, choice } switch { - case index < len(choices): + case index <= len(choices): return nil, index - 1, nil default: return credentials[index-len(choices)-1], 0, nil