diff --git a/pkg/prompt/prompt.go b/pkg/prompt/prompt.go index ca1d1f0b442e768653cbc844dcb9c66003c72030..0e1058e22034200bc4d13982d13d31765a72f6f3 100644 --- a/pkg/prompt/prompt.go +++ b/pkg/prompt/prompt.go @@ -74,14 +74,7 @@ func (p multipleChoicePrompt) PromptMessage(name string) string { func (p multipleChoicePrompt) EvaluateChoice(c string) (interface{}, error) { if c != "" { index, err := strconv.Atoi(c) - if err != nil { - tlog.Warn(fmt.Sprintf("Unrecognized choice %v, using the default choice", index)) - - return p[0], nil - } - - fmt.Println(len(p)) - if index > len(p) || index < 1 { + if err != nil || index < 1 || index > len(p) { tlog.Warn(fmt.Sprintf("Unrecognized choice %v, using the default choice", index)) return p[0], nil