diff options
| author | Ilja Neumann <[email protected]> | 2023-06-03 12:47:47 +0200 |
|---|---|---|
| committer | Ilja Neumann <[email protected]> | 2023-06-03 12:47:47 +0200 |
| commit | 18623d869bfb7aa7b87eda2c8dc7d1bf6149f316 (patch) | |
| tree | 47bc965aac8847cb35791ea5e79871242b9df926 /usage.go | |
| parent | b928a1839ae3502fc6fef8d7743dd78f2c772c8a (diff) | |
help,usage and error messages and tests
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -312,7 +312,18 @@ func (p *Parser) printOption(w io.Writer, spec *spec) { } func (p *Parser) printEnvOnlyVar(w io.Writer, spec *spec) { - printTwoCols(w, spec.env, "", "", "") + ways := make([]string, 0, 2) + if spec.required { + ways = append(ways, "Required.") + } else { + ways = append(ways, "Optional.") + } + + if spec.help != "" { + ways = append(ways, spec.help) + } + + printTwoCols(w, spec.env, strings.Join(ways, " "), spec.defaultString, "") } // lookupCommand finds a subcommand based on a sequence of subcommand names. The |
