summaryrefslogtreecommitdiff
path: root/internal/askcli/command_complete_uuids.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/askcli/command_complete_uuids.go')
-rw-r--r--internal/askcli/command_complete_uuids.go28
1 files changed, 28 insertions, 0 deletions
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
+}