Skip to content

Commit 888d434

Browse files
committed
fix: use option Name instead of Flag when emitting missing error
Some options (e.g. environment-controlled secrets) have no flag name, leading to a confusing error message.
1 parent 00b6c3f commit 888d434

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

command.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ func (inv *Invocation) run(state *runState) error {
392392
var missing []string
393393
for _, opt := range inv.Command.Options {
394394
if opt.Required && opt.ValueSource == ValueSourceNone {
395-
missing = append(missing, opt.Flag)
395+
name := opt.Name
396+
// use flag as a fallback if name is empty
397+
if name == "" {
398+
name = opt.Flag
399+
}
400+
missing = append(missing, name)
396401
}
397402
}
398403
// Don't error for missing flags if `--help` was supplied.

0 commit comments

Comments
 (0)