Skip to content

Commit

Permalink
enable case insensitivity comparison in filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mhewedy committed May 30, 2020
1 parent 486e865 commit a3a714e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vms/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (f filter) apply(list vmInfoList) vmInfoList {
rv := reflect.ValueOf(e)

for _, field := range fields {
if f.name == field && strings.Contains(rv.FieldByName(field).String(), f.value) {
if f.name == field && strings.Contains(strings.ToLower(rv.FieldByName(field).String()), f.value) {
filtered = append(filtered, e)
}
}
Expand Down Expand Up @@ -109,7 +109,7 @@ func parseFilters(filters []string) ([]filter, error) {
if len(parts) != 2 || len(parts[1]) == 0 {
return nil, fmt.Errorf("Failed to parse fitler: %s\n", f)
}
out[i] = filter{name: parts[0], value: parts[1]}
out[i] = filter{name: strings.ToLower(parts[0]), value: strings.ToLower(parts[1])}
}
return out, nil
}
Expand Down

0 comments on commit a3a714e

Please sign in to comment.