diff options
| author | Alex Flint <[email protected]> | 2016-01-18 08:24:21 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2016-01-18 08:24:21 -0800 |
| commit | 4197d283e41bbce1a2cac20ea56fd1156a677db1 (patch) | |
| tree | 190c6ae11f0cee7d7eccbeb05e0d972c861fc6b7 /usage.go | |
| parent | 77be03b90761b82eba21944a2486758973f110e9 (diff) | |
extract common colWidth constant
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -9,6 +9,9 @@ import ( "strings" ) +// the width of the left column +const colWidth = 25 + // Fail prints usage information to stderr and exits with non-zero status func (p *Parser) Fail(msg string) { p.WriteUsage(os.Stderr) @@ -69,9 +72,6 @@ func (p *Parser) WriteHelp(w io.Writer) { p.WriteUsage(w) - // the width of the left column - const colWidth = 25 - // write the list of positionals if len(positionals) > 0 { fmt.Fprint(w, "\npositional arguments:\n") @@ -101,7 +101,6 @@ func (p *Parser) WriteHelp(w io.Writer) { } func printOption(w io.Writer, spec *spec) { - const colWidth = 25 left := " " + synopsis(spec, "--"+spec.long) if spec.short != "" { left += ", " + synopsis(spec, "-"+spec.short) |
