cmd: Fix bug checking value conflicts (e.g. --lightserv conflicting with --syncmode=light).

This commit is contained in:
Ryan Schneider 2018-06-01 14:58:33 -07:00
parent eae63c511c
commit f8cf06821b

View file

@ -976,13 +976,17 @@ func checkExclusive(ctx *cli.Context, args ...interface{}) {
name := flag.GetName() name := flag.GetName()
if i+1 < len(args) { if i+1 < len(args) {
switch option := args[i+1].(type) { switch 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
option := args[i+1].(string)
if ctx.GlobalString(flag.GetName()) == option { if ctx.GlobalString(flag.GetName()) == option {
name += "=" + option name += "=" + option
set = append(set, "--"+name)
} }
// shift arguments and continue
i++ i++
continue
case cli.Flag: case cli.Flag:
default: default: