Skip to content

Commit

Permalink
fix(cli): make isFlagInFlagSet more robust incase it is called with '…
Browse files Browse the repository at this point in the history
…--' (#7029)

### Changes are visible to end-users: no

### Test plan

CI

Co-authored-by: Greg Magolan <[email protected]>
GitOrigin-RevId: 72ca500133f72b926bee8df1f476c928ea3ff0cd
  • Loading branch information
jbedard and gregmagolan committed Oct 23, 2024
1 parent 42f4b5e commit f163779
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/aspect/root/flags/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func isFlagInFlagSet(flags *pflag.FlagSet, arg string) bool {
var flag *pflag.Flag
if arg[0] == '-' {
if arg[1] == '-' {
if len(arg) <= 2 {
return false
}
flag = flags.Lookup(strings.SplitN(arg[2:], "=", 2)[0])
} else {
for _, s := range arg[1:] {
Expand Down

0 comments on commit f163779

Please sign in to comment.