summaryrefslogtreecommitdiff
path: root/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'parse.go')
-rw-r--r--parse.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse.go b/parse.go
index 1ebb2a4..7588dfb 100644
--- a/parse.go
+++ b/parse.go
@@ -653,7 +653,11 @@ func (p *Parser) process(args []string) error {
}
if spec.required {
- return fmt.Errorf("%s is required", name)
+ msg := fmt.Sprintf("%s is required", name)
+ if spec.env != "" {
+ msg += " (or environment variable " + spec.env + ")"
+ }
+ return errors.New(msg)
}
if spec.defaultVal != "" {
err := scalar.ParseValue(p.val(spec.dest), spec.defaultVal)