diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-22 21:21:02 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-22 21:21:02 +0200 |
| commit | 00ff404454c3fc04e13e39992d6dd1200bad9191 (patch) | |
| tree | f59b6a976f38055fe2796bd12de4921c0fb08e8b /internal/askcli/command_list.go | |
| parent | 6fd142f00772a1843b2bece2b779189dd5dcbb21 (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/command_list.go')
| -rw-r--r-- | internal/askcli/command_list.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/askcli/command_list.go b/internal/askcli/command_list.go index ee45e6f..e6571e5 100644 --- a/internal/askcli/command_list.go +++ b/internal/askcli/command_list.go @@ -37,6 +37,35 @@ func (d Dispatcher) handleList(ctx context.Context, args []string, stdout, stder return 0, nil } +func (d Dispatcher) handleAll(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { + filterArgs := []string{"export", "status:any"} + for _, arg := range args[1:] { + if strings.HasPrefix(arg, "limit:") || strings.HasPrefix(arg, "sort:") || + strings.HasPrefix(arg, "+") || arg == "started" { + filterArgs = append(filterArgs, arg) + } + } + var outBuf bytes.Buffer + code, err := d.runner.Run(ctx, filterArgs, nil, &outBuf, stderr) + if code != 0 { + return code, err + } + tasks, err := ParseTaskExport(&outBuf) + if err != nil { + return 1, nil + } + sort.Slice(tasks, func(i, j int) bool { + pi := priorityOrder(tasks[i].Priority) + pj := priorityOrder(tasks[j].Priority) + if pi != pj { + return pi < pj + } + return tasks[i].Urgency > tasks[j].Urgency + }) + io.WriteString(stdout, FormatTaskList(tasks)) + return 0, nil +} + func priorityOrder(p string) int { switch p { case "H": |
