From c514262eb8bfd4042719efd28335f0e1ad9a4f48 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 26 Mar 2026 22:28:52 +0200 Subject: ask: speed up fish UUID completion --- internal/askcli/command_complete_uuids.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/askcli/command_complete_uuids.go (limited to 'internal/askcli/command_complete_uuids.go') diff --git a/internal/askcli/command_complete_uuids.go b/internal/askcli/command_complete_uuids.go new file mode 100644 index 0000000..99f1e0e --- /dev/null +++ b/internal/askcli/command_complete_uuids.go @@ -0,0 +1,28 @@ +package askcli + +import ( + "bytes" + "context" + "fmt" + "io" +) + +func (d Dispatcher) handleCompleteUUIDs(ctx context.Context, stdout, stderr io.Writer) (int, error) { + var outBuf bytes.Buffer + code, err := d.runner.Run(ctx, []string{"status:pending", "export"}, nil, &outBuf, stderr) + if code != 0 { + return code, err + } + tasks, err := ParseTaskExport(&outBuf) + if err != nil { + fmt.Fprintf(stderr, "error: failed to parse task data: %v\n", err) + return 1, nil + } + for _, task := range tasks { + if task.UUID == "" { + continue + } + _, _ = io.WriteString(stdout, task.UUID+"\n") + } + return 0, nil +} -- cgit v1.2.3