summaryrefslogtreecommitdiff
path: root/usage.go
diff options
context:
space:
mode:
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())