summaryrefslogtreecommitdiff
path: root/usage.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2019-04-30 13:30:23 -0700
committerAlex Flint <[email protected]>2019-04-30 13:30:23 -0700
commitaf12b7cfc22b056f6232bb25f5f4b7d35ca37e7e (patch)
treee0cd566ec0bfc60807c7acc745937921e1a46992 /usage.go
parent6a796e2c4131f734028186c023c32e08b5ef7758 (diff)
introduced path struct
Diffstat (limited to 'usage.go')
-rw-r--r--usage.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/usage.go b/usage.go
index 833046f..d73da71 100644
--- a/usage.go
+++ b/usage.go
@@ -115,14 +115,12 @@ func (p *Parser) WriteHelp(w io.Writer) {
long: "help",
short: "h",
help: "display this help and exit",
- root: -1,
})
if p.version != "" {
p.printOption(w, &spec{
boolean: true,
long: "version",
help: "display version and exit",
- root: -1,
})
}
}
@@ -143,8 +141,8 @@ func (p *Parser) printOption(w io.Writer, spec *spec) {
}
// If spec.dest is not the zero value then a default value has been added.
var v reflect.Value
- if spec.root >= 0 {
- v = p.readable(spec)
+ if len(spec.dest.fields) > 0 {
+ v = p.readable(spec.dest)
}
if v.IsValid() {
z := reflect.Zero(v.Type())