Cmd can be passthrough now, too.

Fixes #253.
This commit is contained in:
Mitar
2022-01-04 21:58:56 +01:00
committed by Alec Thomas
parent 76d5ed9ac1
commit a7d3850e80
6 changed files with 129 additions and 23 deletions
+2 -2
View File
@@ -235,8 +235,8 @@ func hydrateTag(t *Tag, typ reflect.Type) error { // nolint: gocyclo
return fmt.Errorf("enum value is only valid if it is either required or has a valid default value")
}
passthrough := t.Has("passthrough")
if passthrough && !t.Arg {
return fmt.Errorf("passthrough only makes sense for positional arguments")
if passthrough && !t.Arg && !t.Cmd {
return fmt.Errorf("passthrough only makes sense for positional arguments or commands")
}
t.Passthrough = passthrough
return nil