Skip to content

Commit

Permalink
Fix edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshnoronha committed Apr 20, 2023
1 parent a0fcf44 commit 8ddb74e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ func toUserCmd(cmd *cobra.Command, args []string) *userCmd {
if feature == "" {
f, _ := cmd.Flags().GetString("feature")
uCmd.features = strings.Split(f, ",")
} else {
uCmd.features = strings.Split(feature, ",")
}

//output control
Expand Down Expand Up @@ -174,8 +172,12 @@ func validateFlags(cmd *userCmd) error {
return fmt.Errorf("invalid category: %s", cmd.category)
}

if cmd.features != nil {
if cmd.features != nil && len(cmd.features) > 0 {
for _, f := range cmd.features {
if f == "" {
continue
}

if !lo.Contains(scorer.CriteriaArgs, f) {
return fmt.Errorf("invalid feature: %s", f)
}
Expand Down

0 comments on commit 8ddb74e

Please sign in to comment.