summaryrefslogtreecommitdiff
path: root/usage.go
diff options
context:
space:
mode:
Diffstat (limited to 'usage.go')
-rw-r--r--usage.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/usage.go b/usage.go
index c76644f..0498910 100644
--- a/usage.go
+++ b/usage.go
@@ -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