summaryrefslogtreecommitdiff
path: root/internal/askcli/dispatch_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-22 21:21:02 +0200
committerPaul Buetow <paul@buetow.org>2026-03-22 21:21:02 +0200
commit00ff404454c3fc04e13e39992d6dd1200bad9191 (patch)
treef59b6a976f38055fe2796bd12de4921c0fb08e8b /internal/askcli/dispatch_test.go
parent6fd142f00772a1843b2bece2b779189dd5dcbb21 (diff)
ask: default to list, add ask all for complete task visibility
- ask (no args) now behaves like ask list (active tasks sorted by priority/urgency) - ask help: explicit help subcommand - ask all: shows ALL tasks including completed/deleted (uses status:any) - handleAll added in command_list.go, mirrors handleList with status:any - Updated tests: help tests use explicit 'ask help', all subcommand added to reachability test - Updated help text to document ask all
Diffstat (limited to 'internal/askcli/dispatch_test.go')
-rw-r--r--internal/askcli/dispatch_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/askcli/dispatch_test.go b/internal/askcli/dispatch_test.go
index 4746c67..b1aa820 100644
--- a/internal/askcli/dispatch_test.go
+++ b/internal/askcli/dispatch_test.go
@@ -11,7 +11,7 @@ import (
func TestDispatcher_Help(t *testing.T) {
d := NewDispatcher(nil)
var stdout bytes.Buffer
- code, err := d.Dispatch(context.Background(), []string{}, nil, &stdout, io.Discard)
+ code, err := d.Dispatch(context.Background(), []string{"help"}, nil, &stdout, io.Discard)
if code != 0 {
t.Fatalf("help exit code = %d, want 0", code)
}
@@ -25,6 +25,9 @@ func TestDispatcher_Help(t *testing.T) {
if !strings.Contains(output, "ask list") {
t.Fatalf("help missing list subcommand: %s", output)
}
+ if !strings.Contains(output, "ask all") {
+ t.Fatalf("help missing all subcommand: %s", output)
+ }
if !strings.Contains(output, "Filters:") {
t.Fatalf("help missing Filters section: %s", output)
}
@@ -49,9 +52,9 @@ func TestDispatcher_UnknownSubcommand(t *testing.T) {
func TestDispatcher_LongHelp(t *testing.T) {
d := NewDispatcher(nil)
var stdout bytes.Buffer
- d.Dispatch(context.Background(), []string{}, nil, &stdout, io.Discard)
+ d.Dispatch(context.Background(), []string{"help"}, nil, &stdout, io.Discard)
output := stdout.String()
- for _, sub := range []string{"add", "list", "info", "annotate", "start", "stop", "done", "priority", "tag", "dep", "urgency", "modify", "denotate", "delete", "export"} {
+ for _, sub := range []string{"add", "list", "all", "info", "annotate", "start", "stop", "done", "priority", "tag", "dep", "urgency", "modify", "denotate", "delete", "export"} {
if !strings.Contains(output, "ask "+sub) {
t.Errorf("help missing subcommand: ask %s", sub)
}
@@ -72,6 +75,7 @@ func TestDispatcher_AllSubcommandsReachExecutor(t *testing.T) {
"tag": {"tag", "test-uuid", "+cli"},
"dep": {"dep", "list", "test-uuid"},
"list": {"list"},
+ "all": {"all"},
"urgency": {"urgency"},
"info": {"info", "test-uuid"},
"add": {"add", "new task description"},