diff options
| author | Alex Flint <[email protected]> | 2016-01-18 10:31:01 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2016-01-18 10:31:01 -0800 |
| commit | b1ec8c909335d0a72b6887aea5e7428f3cff60a8 (patch) | |
| tree | 2e15e749e4af7c6d84caa43439592f4407759262 /usage.go | |
| parent | c9155bb0c3e57557bae7d7c54b60ab8fe2e95211 (diff) | |
make it possible to override the name of the program
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -4,7 +4,6 @@ import ( "fmt" "io" "os" - "path/filepath" "reflect" "strings" ) @@ -30,7 +29,7 @@ func (p *Parser) WriteUsage(w io.Writer) { } } - fmt.Fprintf(w, "usage: %s", filepath.Base(os.Args[0])) + fmt.Fprintf(w, "usage: %s", p.config.Program) // write the option component of the usage message for _, spec := range options { @@ -114,8 +113,7 @@ 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 + // If spec.dest is not the zero value then a default value has been added. v := spec.dest if v.IsValid() { z := reflect.Zero(v.Type()) |
