From 0b65465b8c5f3702f9f6de44e764d4db9bfba42e Mon Sep 17 00:00:00 2001 From: Waleed Gadelkareem Date: Thu, 31 Mar 2022 12:06:33 +0200 Subject: [PATCH] Trim and lowercase for column selectors (#375) * trim and lowercase for column selectors * Fix index out of range --- internal/cmd/output/output.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/cmd/output/output.go b/internal/cmd/output/output.go index 2e34d40b..4046125f 100644 --- a/internal/cmd/output/output.go +++ b/internal/cmd/output/output.go @@ -91,7 +91,8 @@ func validateOutputFlag(options []outputOption) func(cmd *cobra.Command, args [] if _, ok := validOptions[parts[0]]; !ok { return fmt.Errorf("invalid output option: %s", parts[0]) } - if validOptions[parts[0]] != nil { + if len(parts) > 1 && validOptions[parts[0]] != nil { + parts[1] = strings.ToLower(strings.TrimSpace(parts[1])) for _, v := range strings.Split(parts[1], ",") { if !validOptions[parts[0]][v] { return fmt.Errorf("invalid value for output option %s: %s", parts[0], v)