From 6fa6848496abd984156167a1c873fca6c724a1f7 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 27 Mar 2026 11:22:04 +0200 Subject: Extract parseGlobalFlags helper --- internal/askcli/dispatch_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/askcli/dispatch_test.go') diff --git a/internal/askcli/dispatch_test.go b/internal/askcli/dispatch_test.go index a863481..91f4784 100644 --- a/internal/askcli/dispatch_test.go +++ b/internal/askcli/dispatch_test.go @@ -154,6 +154,16 @@ func TestDispatcher_DispatchPersistsJSONFlagOnDispatcher(t *testing.T) { } } +func TestParseGlobalFlags(t *testing.T) { + filtered, jsonOutput := parseGlobalFlags([]string{"--json", "list", "--json", "extra"}) + if !jsonOutput { + t.Fatalf("json flag not detected") + } + if got := strings.Join(filtered, " "); got != "list extra" { + t.Fatalf("filtered args = %q, want \"list extra\"", got) + } +} + func TestDispatcher_AllSubcommandsReachExecutor(t *testing.T) { dir := t.TempDir() oldRoot := taskAliasCacheRoot -- cgit v1.2.3