From 142f226caa1c0edff7c9fa1c434b88fdafb0fd17 Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 4 Oct 2024 11:14:59 +0530 Subject: [PATCH] Added Check --- internal/cli/input.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/cli/input.go b/internal/cli/input.go index 3db017bd..ec6e3ef9 100644 --- a/internal/cli/input.go +++ b/internal/cli/input.go @@ -2,10 +2,10 @@ package cli import ( "fmt" - "os" - "github.com/AlecAivazis/survey/v2/terminal" "github.com/auth0/go-auth0" + "os" + "reflect" "github.com/auth0/auth0-cli/internal/prompt" ) @@ -59,6 +59,10 @@ func askPassword(i commandInput, value interface{}, isUpdate bool) error { } func askMultiSelect(i commandInput, value interface{}, options ...string) error { + v := reflect.ValueOf(options) + if v.Kind() != reflect.Slice || v.Len() <= 0 { + return handleInputError(fmt.Errorf("there is not enough data to select from")) + } if err := prompt.AskMultiSelect(i.GetLabel(), value, options...); err != nil { return handleInputError(err) }