diff options
| author | Cameron Moore <[email protected]> | 2016-09-09 08:42:53 -0500 |
|---|---|---|
| committer | Cameron Moore <[email protected]> | 2016-09-09 08:42:53 -0500 |
| commit | 5b54501df936f43e0d858576a9285b65f30407fa (patch) | |
| tree | 1adc4c7daa8182dacc9226e19bd4edc9310ee855 /flag.go | |
| parent | 6fd2ff4ff8dfcdf5556fbdc0ac0284408274b1a7 (diff) | |
Fix default values for custom fields
Fallback to the original default detection logic if we have an unknown
type.
Fixes #91
Diffstat (limited to 'flag.go')
| -rw-r--r-- | flag.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -437,7 +437,17 @@ func (f *Flag) defaultIsZeroValue() bool { case *intSliceValue, *stringSliceValue, *stringArrayValue: return f.DefValue == "[]" default: - return true + switch f.Value.String() { + case "false": + return true + case "<nil>": + return true + case "": + return true + case "0": + return true + } + return false } } |
