Skip to content

Commit

Permalink
Trim and lowercase for column selectors (#375)
Browse files Browse the repository at this point in the history
* trim and lowercase for column selectors

* Fix index out of range
  • Loading branch information
gadelkareem authored Mar 31, 2022
1 parent 5c5b3ad commit 0b65465
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/cmd/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0b65465

Please sign in to comment.