summaryrefslogtreecommitdiff
path: root/internal/askcli/dispatch_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-27 11:22:04 +0200
committerPaul Buetow <paul@buetow.org>2026-03-27 11:22:04 +0200
commit6fa6848496abd984156167a1c873fca6c724a1f7 (patch)
tree48168ae240bb0528dd30609b83dbcf8f49410e44 /internal/askcli/dispatch_test.go
parent148c6344a011e0a707016d5825f27b4f3df4dcc4 (diff)
Extract parseGlobalFlags helper
Diffstat (limited to 'internal/askcli/dispatch_test.go')
-rw-r--r--internal/askcli/dispatch_test.go10
1 files changed, 10 insertions, 0 deletions
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