feat: allowing this to be ran in automated contexts

Signed-off-by: Alex Yong <alexjyong@gmail.com>
This commit is contained in:
Alex Yong 2025-08-11 11:52:42 -04:00 committed by GitHub
parent 1b003918b0
commit 5bcf8a325a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 5 deletions

View File

@ -1,4 +1,14 @@
import { resolve } from "jsr:@std/path"
import { parseArgs } from "jsr:@std/cli/parse-args"
const args = parseArgs(Deno.args, {
boolean: ["yes", "y", "auto-accept"],
alias: {
"y": "yes"
}
})
const autoAccept = args.yes || args["auto-accept"]
const outputFolderParent = resolve(Deno.cwd(), "app", "src", "main", "assets")
@ -13,7 +23,7 @@ try {
console.error(
"Usage: " +
"\x1b[35m" + // magenta
"deno run -A scripts/download_deps.ts" +
"deno run -A scripts/download_deps.ts [--yes|-y|--auto-accept]" +
"\x1b[0m" +
" from the " +
"\x1b[1;31;4m" + // bold red underline
@ -299,10 +309,14 @@ for (const dep of deps) {
console.log(`- ${dep.file} from ${dep.url}`)
}
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
if (!autoAccept) {
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
}
} else {
console.log("Will download the above files. (auto-accepted)")
}
const fontsFolder = resolve(outputFolder, "fonts")