diff options
| author | Alex Flint <[email protected]> | 2016-02-22 06:39:41 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2016-02-22 06:39:41 -0800 |
| commit | aaae1550b702cee36c45fdee30a58ba4cc733edd (patch) | |
| tree | 75b89708e530965be7914164c94f09219ab750a0 /usage.go | |
| parent | 77dd0df006f564a0768ee7ddc194f08e328f864e (diff) | |
| parent | b1ec8c909335d0a72b6887aea5e7428f3cff60a8 (diff) | |
Merge pull request #32 from alexflint/override_program_name
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()) |
