Merge deno completions update from #9676

(Can't cherry-pick because GitHub tricked me into rebasing instead of
squashing.)
This commit is contained in:
Mahmoud Al-Qudsi 2023-03-22 11:04:41 -05:00
parent e00f63b9e9
commit 80b31e87ec

View file

@ -1 +1,19 @@
deno completions fish | source deno completions fish | source
# complete deno task
set searchForDenoFilesCode '
// order matters
const denoFile = ["deno.json", "deno.jsonc", "package.json"];
for (const file of denoFile) {
try {
Deno.statSync(file);
// file exists
const props = file === "package.json" ? "scripts" : "tasks";
console.log(
Object.keys(JSON.parse(Deno.readTextFileSync(file))[props]).join("\n"),
);
break;
} catch {}
}
'
complete -f -c deno -n "__fish_seen_subcommand_from task" -n "__fish_is_nth_token 2" -a "(deno eval '$searchForDenoFilesCode')"