mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Update deno task completions to handle deno.jsonc and package.json
This commit is contained in:
parent
da3323bbc2
commit
93bf4e1187
1 changed files with 23 additions and 1 deletions
|
@ -1,2 +1,24 @@
|
|||
deno completions fish | source
|
||||
complete -f -c deno -n "__fish_seen_subcommand_from task" -a "(deno eval \"try {console.log(Object.keys(JSON.parse(Deno.readTextFileSync('deno.json')).tasks).join('\n'))} catch {} \")"
|
||||
|
||||
# complete deno task
|
||||
set searchForDenoFilesCode '
|
||||
const denoFile = ["deno.json", "deno.jsonc", "package.json"];
|
||||
for (const file of denoFile) {
|
||||
try {
|
||||
Deno.statSync(file);
|
||||
// file exists
|
||||
if (file === "package.json") {
|
||||
console.log(
|
||||
Object.keys(JSON.parse(Deno.readTextFileSync(file)).scripts).join("\n"),
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
Object.keys(JSON.parse(Deno.readTextFileSync(file)).tasks).join("\n"),
|
||||
);
|
||||
}
|
||||
break;
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
'
|
||||
complete -f -c deno -n "__fish_seen_subcommand_from task" -a "(deno eval '$searchForDenoFilesCode')"
|
||||
|
|
Loading…
Reference in a new issue