diff options
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -5,6 +5,7 @@ import ( "io" "os" "path/filepath" + "reflect" "strings" ) @@ -101,6 +102,15 @@ func printOption(w io.Writer, spec *spec) { } fmt.Fprint(w, spec.help) } + // Check if spec.dest is zero value or not + // If it isn't a default value have been added + v := spec.dest + if v.IsValid() { + z := reflect.Zero(v.Type()) + if v.Interface() != z.Interface() { + fmt.Fprintf(w, " [default: %v]", v) + } + } fmt.Fprint(w, "\n") } |
