Skip to content

Commit

Permalink
fix: regression where all args became passthrough
Browse files Browse the repository at this point in the history
Fixes #475
  • Loading branch information
alecthomas committed Dec 2, 2024
1 parent 96647c3 commit 81d0c29
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,16 @@ func hydrateTag(t *Tag, typ reflect.Type) error { //nolint: gocyclo
return fmt.Errorf("passthrough only makes sense for positional arguments or commands")
}
t.Passthrough = passthrough
passthroughMode := t.Get("passthrough")
switch passthroughMode {
case "partial":
t.PassthroughMode = PassThroughModePartial
case "all", "":
t.PassthroughMode = PassThroughModeAll
default:
return fmt.Errorf("invalid passthrough mode %q, must be one of 'partial' or 'all'", passthroughMode)
if t.Passthrough {
passthroughMode := t.Get("passthrough")
switch passthroughMode {
case "partial":
t.PassthroughMode = PassThroughModePartial
case "all", "":
t.PassthroughMode = PassThroughModeAll
default:
return fmt.Errorf("invalid passthrough mode %q, must be one of 'partial' or 'all'", passthroughMode)
}
}
return nil
}
Expand Down

0 comments on commit 81d0c29

Please sign in to comment.