From 81d0c29303442ba216395c690b07526ede3ca34a Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Tue, 3 Dec 2024 08:22:10 +1100 Subject: [PATCH] fix: regression where all args became passthrough Fixes #475 --- tag.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tag.go b/tag.go index 00fb7e7..226171b 100644 --- a/tag.go +++ b/tag.go @@ -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 }