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