fish-shell/share/completions/deno.fish

20 lines
567 B
Fish
Raw Normal View History

2021-11-23 02:52:12 +08:00
deno completions fish | source
# complete deno task
set searchForDenoFilesCode '
2023-03-22 14:34:32 +08:00
// order matters
const denoFile = ["deno.json", "deno.jsonc", "package.json"];
for (const file of denoFile) {
try {
Deno.statSync(file);
// file exists
2023-03-22 14:34:32 +08:00
const props = file === "package.json" ? "scripts" : "tasks";
console.log(
Object.keys(JSON.parse(Deno.readTextFileSync(file))[props]).join("\n"),
);
break;
2023-03-22 14:34:32 +08:00
} catch {}
}
'
2023-03-22 14:29:29 +08:00
complete -f -c deno -n "__fish_seen_subcommand_from task" -n "__fish_is_nth_token 2" -a "(deno eval '$searchForDenoFilesCode')"