Skip to content

Commit

Permalink
Merge pull request #141 from interlynk-io/fix/v0.0.14
Browse files Browse the repository at this point in the history
Fix edge case
  • Loading branch information
riteshnoronha authored Apr 20, 2023
2 parents a0fcf44 + 8ddb74e commit a739153
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 a739153

Please sign in to comment.