diff options
| author | Pablo Diaz <[email protected]> | 2022-05-21 17:44:32 +0200 |
|---|---|---|
| committer | Ilja Neumann <[email protected]> | 2023-06-03 02:39:56 +0200 |
| commit | 5f10667949b09f9a43c241d969eea8d3ba9456c0 (patch) | |
| tree | f699c397356663d51f6f923cc49d78b4b5c31592 /usage.go | |
| parent | c3cac76438ca36d9291d2a26f3ba558ef929d588 (diff) | |
fixed tests
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -84,9 +84,10 @@ func (p *Parser) writeUsageForSubcommand(w io.Writer, cmd *command) { ancestors = append(ancestors, ancestor.name) ancestor = ancestor.parent } + // Print environment only variables for _, spec := range cmd.specs { if spec.short == "" && spec.long == "" { - ancestors = append(ancestors, spec.env+"="+strings.ToLower(spec.env)+"_value") + ancestors = append(ancestors, "["+spec.env+"="+strings.ToLower(spec.env)+"_value"+"]") } } @@ -283,7 +284,7 @@ func (p *Parser) writeHelpForSubcommand(w io.Writer, cmd *command) { } // write the list of environment only variables - if len(shortOptions)+len(longOptions) > 0 || cmd.parent == nil { + if len(envOnlyOptions) > 0 { fmt.Fprint(w, "\nEnvironment variables:\n") for _, spec := range envOnlyOptions { p.printEnvOnlyVar(w, spec) |
