Skip to content

Commit

Permalink
Add case insensitivity to flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ubombar committed Mar 21, 2024
1 parent f2e07f0 commit 587ff83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package utils
import (
"context"
"fmt"
"strings"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -43,9 +44,11 @@ func (s *FlagList) String() string {
return fmt.Sprintf("%v", *s)
}

// Checks if the given flag is contained in the flag list. The check is performed
// without regarding capitalization (used strings.EqualFold).
func (s *FlagList) Contains(flag string) bool {
for _, f := range *s {
if f == flag {
if strings.EqualFold(f, flag) {
return true
}
}
Expand Down

0 comments on commit 587ff83

Please sign in to comment.