diff options
| author | Eric Paris <[email protected]> | 2016-08-15 11:43:41 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-08-15 11:43:41 -0400 |
| commit | 01665e1eb3d0533dca0e5acffdff9eec1fcb886f (patch) | |
| tree | 4ad1d38af3c5051df2717130aadea4c40d3699d7 | |
| parent | f676131e2660dc8cd88de99f7486d34aa8172635 (diff) | |
| parent | f26459a1aa7b2634987fa42b7b82de0173709bb3 (diff) | |
Merge pull request #85 from bogem/usage
Use flag's string type in usage
| -rw-r--r-- | flag.go | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -455,22 +455,19 @@ func UnquoteUsage(flag *Flag) (name string, usage string) { break // Only one back quote; use type name. } } - // No explicit name, so use type if we can find one. - name = "value" - switch flag.Value.(type) { - case boolFlag: + + name = flag.Value.Type() + switch name { + case "bool": name = "" - case *durationValue: - name = "duration" - case *float64Value: + case "float64": name = "float" - case *intValue, *int64Value: + case "int64": name = "int" - case *stringValue: - name = "string" - case *uintValue, *uint64Value: + case "uint64": name = "uint" } + return } |
