1
0
mirror of https://github.com/rclone/rclone.git synced 2025-01-13 20:38:12 +02:00

cmd: fix boolean backend flags - fixes #2402

Before this change, boolean flags such as `--b2-hard-delete` were
failing to be recognised unless they had a parameter.

This bug was introduced as part of the config re-organisation:
f3f48d7d49
This commit is contained in:
Nick Craig-Wood 2018-07-18 15:43:57 +01:00
parent dcc74fa404
commit b1f31c2acf

View File

@ -523,7 +523,7 @@ func AddBackendFlags() {
}
help = strings.TrimSpace(help)
flag := pflag.CommandLine.VarPF(opt, name, string(opt.ShortOpt), help)
if _, isBool := opt.Value.(bool); isBool {
if _, isBool := opt.Default.(bool); isBool {
flag.NoOptDefVal = "true"
}
// Hide on the command line if requested