cmd/utils: fix bug when checking for flag value conflicts (#17803)

This commit is contained in:
Daniel Liu 2024-12-13 10:27:25 +08:00
parent 7cd3e56d18
commit c0f547ca78

View file

@ -1318,11 +1318,14 @@ func checkExclusive(ctx *cli.Context, args ...interface{}) {
if i+1 < len(args) { if i+1 < len(args) {
switch option := args[i+1].(type) { switch option := args[i+1].(type) {
case string: case string:
// Extended flag, expand the name and shift the arguments // Extended flag check, make sure value set doesn't conflict with passed in option
if ctx.String(flag.Names()[0]) == option { if ctx.String(flag.Names()[0]) == option {
name += "=" + option name += "=" + option
set = append(set, "--"+name)
} }
// shift arguments and continue
i++ i++
continue
case cli.Flag: case cli.Flag:
default: default: