diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-22 22:26:19 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-22 22:26:19 +0200 |
| commit | a0f7ee1cd4b0833ff45b94e2a35c60227e6ec1e3 (patch) | |
| tree | cf85a206d88431dc88c6d882d07ff2a9fb70f331 | |
| parent | f6ce62d4e5cefc4a7761bbb86f329ad08ba57570 (diff) | |
ask list: only show pending tasks by defaultv0.25.3
Add status:pending filter to list command so it only shows pending
tasks, not completed or deleted ones. Use 'ask all' to see all tasks.
| -rwxr-xr-x | cmd/ask/ask | bin | 0 -> 3528033 bytes | |||
| -rw-r--r-- | internal/askcli/command_list.go | 2 | ||||
| -rw-r--r-- | internal/askcli/command_list_test.go | 32 | ||||
| -rw-r--r-- | internal/version.go | 2 |
4 files changed, 26 insertions, 10 deletions
diff --git a/cmd/ask/ask b/cmd/ask/ask Binary files differnew file mode 100755 index 0000000..9990730 --- /dev/null +++ b/cmd/ask/ask diff --git a/internal/askcli/command_list.go b/internal/askcli/command_list.go index b5c5429..82b7ff5 100644 --- a/internal/askcli/command_list.go +++ b/internal/askcli/command_list.go @@ -9,7 +9,7 @@ import ( ) func (d Dispatcher) handleList(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { - filterArgs := []string{"export"} + filterArgs := []string{"status:pending", "export"} for _, arg := range args[1:] { if strings.HasPrefix(arg, "limit:") || strings.HasPrefix(arg, "sort:") || strings.HasPrefix(arg, "+") || arg == "started" { diff --git a/internal/askcli/command_list_test.go b/internal/askcli/command_list_test.go index 745a402..e6bce83 100644 --- a/internal/askcli/command_list_test.go +++ b/internal/askcli/command_list_test.go @@ -11,8 +11,11 @@ import ( func TestHandleList_Success(t *testing.T) { jsonData := `[{"uuid":"uuid-1","description":"Task 1","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":[]},{"uuid":"uuid-2","description":"Task 2","status":"completed","priority":"M","tags":["agent"],"urgency":10.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, jsonData) + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } } return 0, nil }}) @@ -30,8 +33,11 @@ func TestHandleList_Success(t *testing.T) { func TestHandleList_SortedByPriority(t *testing.T) { jsonData := `[{"uuid":"uuid-2","description":"Task 2","status":"pending","priority":"M","tags":[],"urgency":10.0,"depends":[]},{"uuid":"uuid-1","description":"Task 1","status":"pending","priority":"H","tags":[],"urgency":5.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, jsonData) + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } } return 0, nil }}) @@ -47,8 +53,11 @@ func TestHandleList_SortedByPriority(t *testing.T) { func TestHandleList_EmptyList(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, "[]") + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, "[]") + return 0, nil + } } return 0, nil }}) @@ -71,7 +80,14 @@ func TestHandleList_PassesFilters(t *testing.T) { if len(capturedArgs) < 2 { t.Fatalf("expected export args, got %v", capturedArgs) } - if capturedArgs[0] != "export" { - t.Fatalf("first arg should be export, got %s", capturedArgs[0]) + hasExport := false + for _, arg := range capturedArgs { + if arg == "export" { + hasExport = true + break + } + } + if !hasExport { + t.Fatalf("expected export in args, got %v", capturedArgs) } } diff --git a/internal/version.go b/internal/version.go index fa765e6..b73ef9e 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,4 +1,4 @@ // Package internal provides the Hexai semantic version identifier used by CLI and LSP binaries. package internal -const Version = "0.25.2" +const Version = "0.25.3" |
