return CommandLine.Set(name, value)
}
-// isZeroValue guesses whether the string represents the zero
-// value for a flag. It is not accurate but in practice works OK.
+// isZeroValue determines whether the string represents the zero
+// value for a flag.
func isZeroValue(flag *Flag, value string) bool {
// Build a zero value of the flag's Value type, and see if the
// result of calling its String method equals the value passed in.
} else {
z = reflect.Zero(typ)
}
- if value == z.Interface().(Value).String() {
- return true
- }
-
- switch value {
- case "false", "", "0":
- return true
- }
- return false
+ return value == z.Interface().(Value).String()
}
// UnquoteUsage extracts a back-quoted name from the usage
-C a boolean defaulting to true (default true)
-D path
set relative path for local imports
+ -E string
+ issue 23543 (default "0")
-F number
a non-zero number (default 2.7)
-G float
fs.Bool("Alongflagname", false, "disable bounds checking")
fs.Bool("C", true, "a boolean defaulting to true")
fs.String("D", "", "set relative `path` for local imports")
+ fs.String("E", "0", "issue 23543")
fs.Float64("F", 2.7, "a non-zero `number`")
fs.Float64("G", 0, "a float that defaults to zero")
fs.String("M", "", "a multiline\nhelp\nstring")