Skip to content
Snippets Groups Projects
Commit 93050447 authored by Tamer Tas's avatar Tamer Tas
Browse files

pkg/prompt: deduplicate error branches

parent fcad34fa
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment