From 0088bf27368265511d6ff3c49309df843c528d42 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 26 May 2026 10:15:58 +0300 Subject: feat(askcli): add watch subcommand Implements `ask watch [subcommand...]` which re-runs a read-only subcommand every 2 seconds and redraws output when it changes, similar to gnu-watch. Safety features: - Restricted to read-only subcommands (list, all, ready, info, urgency, help, dep list) - Recursive watch is blocked - Captures stderr so error messages are visible in the watched display Also adds readOnly field to commandEntry registry for maintainability. --- internal/askcli/dispatch.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal/askcli/dispatch.go') diff --git a/internal/askcli/dispatch.go b/internal/askcli/dispatch.go index cd2aae7..2cdaa93 100644 --- a/internal/askcli/dispatch.go +++ b/internal/askcli/dispatch.go @@ -54,6 +54,10 @@ func (d *Dispatcher) Dispatch(ctx context.Context, args []string, stdin io.Reade if len(args) == 0 { args = []string{"list"} } + return d.dispatchCommand(ctx, args, stdin, stdout, stderr) +} + +func (d *Dispatcher) dispatchCommand(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { subcommand := args[0] entry, ok := commandRegistry.get(subcommand) if !ok { @@ -90,6 +94,7 @@ func (d *Dispatcher) help(w io.Writer) (int, error) { _, _ = io.WriteString(w, " ask dep rm Remove dependency\n") _, _ = io.WriteString(w, " ask dep list List dependencies\n") _, _ = io.WriteString(w, " ask urgency List tasks sorted by urgency\n") + _, _ = io.WriteString(w, " ask watch [subcommand...] Re-run a read-only subcommand every 2s and redraw on changes\n") _, _ = io.WriteString(w, " ask modify Modify task fields\n") _, _ = io.WriteString(w, " ask denotate \"text\" Remove annotation\n") _, _ = io.WriteString(w, " ask delete Delete a task\n") -- cgit v1.2.3