minor cleanup

This commit is contained in:
sigmaSd 2023-03-22 07:34:32 +01:00 committed by Mahmoud Al-Qudsi
parent b95085609e
commit 860de8aa8f

View file

@ -2,23 +2,18 @@ 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
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"),
);
}
const props = file === "package.json" ? "scripts" : "tasks";
console.log(
Object.keys(JSON.parse(Deno.readTextFileSync(file))[props]).join("\n"),
);
break;
} catch {
}
} catch {}
}
'
complete -f -c deno -n "__fish_seen_subcommand_from task" -n "__fish_is_nth_token 2" -a "(deno eval '$searchForDenoFilesCode')"