From 587ff832cffd022c3e23dd6a4e8357c61a8af536 Mon Sep 17 00:00:00 2001 From: ubombar Date: Thu, 21 Mar 2024 14:22:16 +0100 Subject: [PATCH] Add case insensitivity to flags --- internal/utils/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 8291f78..121508b 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -19,6 +19,7 @@ package utils import ( "context" "fmt" + "strings" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -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 } }