summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-26 22:21:34 +0200
committerPaul Buetow <paul@buetow.org>2026-03-26 22:21:34 +0200
commit9dc8c5e241af77fd61c1da91e0fe49faa5cf06e4 (patch)
tree72388ce9cf8301184aea0841ca9b8e980b06e2a8
parentf6436fe4cfdd989d95607931314a7c47147ee1e2 (diff)
ask: filter fish UUID completion
-rw-r--r--assets/ask.fish2
-rw-r--r--docs/fish-completion.md2
-rw-r--r--internal/askcli/completion.go2
-rw-r--r--internal/askcli/completion_test.go2
4 files changed, 4 insertions, 4 deletions
diff --git a/assets/ask.fish b/assets/ask.fish
index 6c5f904..68fcf9f 100644
--- a/assets/ask.fish
+++ b/assets/ask.fish
@@ -92,7 +92,7 @@ function __ask_in_dep_uuid_context
end
function __ask_task_uuids
- command ask all --json 2>/dev/null | string match -r -a -g '"uuid":"([^"]+)"'
+ command ask all --json 2>/dev/null | jq -r '.[] | select(.status != "completed" and .status != "deleted") | .uuid' 2>/dev/null
end
complete -c ask -f
diff --git a/docs/fish-completion.md b/docs/fish-completion.md
index b37b79d..10966e9 100644
--- a/docs/fish-completion.md
+++ b/docs/fish-completion.md
@@ -3,7 +3,7 @@
Hexai ships a Fish completion file for the `ask` task-management CLI at [`assets/ask.fish`](../assets/ask.fish).
It completes the top-level `ask` subcommands and the nested `ask dep` operations.
-It also completes task UUIDs for UUID-taking commands by reading the current project from `ask all --json`.
+It also completes task UUIDs for UUID-taking commands by reading the current project from `ask all --json` and filtering out completed and deleted tasks.
The script preserves the global `--json` flag.
Install it into Fish's completion directory:
diff --git a/internal/askcli/completion.go b/internal/askcli/completion.go
index 28ad306..e947495 100644
--- a/internal/askcli/completion.go
+++ b/internal/askcli/completion.go
@@ -189,7 +189,7 @@ func writeFishDepUUIDContextFunction(b *strings.Builder) {
func writeFishTaskUUIDFunction(b *strings.Builder) {
b.WriteString("function __ask_task_uuids\n")
- b.WriteString(" command ask all --json 2>/dev/null | string match -r -a -g '\"uuid\":\"([^\"]+)\"'\n")
+ b.WriteString(" command ask all --json 2>/dev/null | jq -r '.[] | select(.status != \"completed\" and .status != \"deleted\") | .uuid' 2>/dev/null\n")
b.WriteString("end\n\n")
}
diff --git a/internal/askcli/completion_test.go b/internal/askcli/completion_test.go
index 439e483..52cdce8 100644
--- a/internal/askcli/completion_test.go
+++ b/internal/askcli/completion_test.go
@@ -36,7 +36,7 @@ func TestFishCompletion_IncludesCommandsAndExcludesExport(t *testing.T) {
"complete -c ask -n '__ask_in_dep_context' -a 'rm' -d 'Remove a dependency'",
"complete -c ask -n '__ask_in_dep_context' -a 'list' -d 'List dependencies'",
"function __ask_task_uuids",
- "command ask all --json 2>/dev/null",
+ "command ask all --json 2>/dev/null | jq -r '.[] | select(.status != \"completed\" and .status != \"deleted\") | .uuid' 2>/dev/null",
"complete -c ask -n '__ask_in_uuid_context' -a '(__ask_task_uuids)' -d 'Show task details'",
"complete -c ask -n '__ask_in_dep_uuid_context' -a '(__ask_task_uuids)' -d 'Add a dependency'",
"complete -c ask -n '__ask_in_dep_uuid_context' -a '(__ask_task_uuids)' -d 'Remove a dependency'",