diff options
| author | Fredrik Wallgren <[email protected]> | 2015-11-11 10:15:57 +0100 |
|---|---|---|
| committer | Fredrik Wallgren <[email protected]> | 2015-11-16 13:23:58 +0100 |
| commit | 330a0da571888c4ec6dac345140a7ee663d00d6e (patch) | |
| tree | dcef4a491306c39ad6f300aa5885d37d7a333a3d /parse.go | |
| parent | c4704194de65e09b88ebae2f2c81ee4e0a3be5d8 (diff) | |
Add built ins to options in help output
Adds help to the options in help output with an easy way to add more
built ins.
Diffstat (limited to 'parse.go')
| -rw-r--r-- | parse.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -54,6 +54,7 @@ type spec struct { positional bool help string wasPresent bool + isBool bool } // ErrHelp indicates that -h or --help were provided @@ -135,6 +136,11 @@ func NewParser(dests ...interface{}) (*Parser, error) { return nil, fmt.Errorf("%s.%s: %s fields are not supported", t.Name(), field.Name, scalarType.Kind()) } + // Specify that it is a bool for usage + if scalarType.Kind() == reflect.Bool { + spec.isBool = true + } + // Look at the tag if tag != "" { for _, key := range strings.Split(tag, ",") { |
