mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
cmd/utils: make mutually exclusive flag error prettier
It now reads: Fatal: flags --dev, --testnet can't be used at the same time
This commit is contained in:
parent
766ce7abca
commit
08c62b128a
1 changed files with 4 additions and 4 deletions
|
|
@ -778,14 +778,14 @@ func setEthash(ctx *cli.Context, cfg *eth.Config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkExclusive(ctx *cli.Context, flags ...cli.BoolFlag) {
|
func checkExclusive(ctx *cli.Context, flags ...cli.BoolFlag) {
|
||||||
set := 0
|
set := make([]string, 0, 1)
|
||||||
for _, flag := range flags {
|
for _, flag := range flags {
|
||||||
if ctx.GlobalIsSet(flag.Name) {
|
if ctx.GlobalIsSet(flag.Name) {
|
||||||
set++
|
set = append(set, "--"+flag.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if set > 1 {
|
if len(set) > 1 {
|
||||||
Fatalf("The %v flags are mutually exclusive", flags)
|
Fatalf("flags %v can't be used at the same time", strings.Join(set, ", "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue