-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-args.ts
More file actions
41 lines (36 loc) · 1.44 KB
/
Copy pathparse-args.ts
File metadata and controls
41 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { parse } from "https://deno.land/std@0.200.0/flags/mod.ts";
import type { Args } from "https://deno.land/std@0.200.0/flags/mod.ts";
export function parseArguments(args: string[]): Args {
// All boolean arguments
const booleanArgs = ["dry-run", "verbose", "foil"];
// All string arguments
const stringArgs = ["output-file", "default-back", "stock"];
// And a list of aliases
const alias = {
help: "h",
"dry-run": "d",
"output-file": "f",
"default-back": "b",
"verbose": "v",
"stock": "s",
"foil": "ff",
};
return parse(args, {
alias,
boolean: booleanArgs,
string: stringArgs,
stopEarly: false,
"--": true,
});
}
export function printHelp(): void {
console.log(`Usage: mpcfill-custom-cards [OPTIONS...]`);
console.log("\nOptional flags:");
console.log(" -h, --help Display this help and exit");
console.log(" -f, --output-file <file> Output path for the card XML (defaults to ./cards.xml)");
console.log(" -b, --default-back <id> Name (without file extension) of the default card back image (defaults to 'default-back')");
console.log(" -s, --stock <stock> Stock type for the cards (defaults to '(S30) Standard Smooth')");
console.log(" -ff, --foil Enable foil printing");
console.log(" -d, --dry-run Run script without writing any files");
console.log(" -v, --verbose Print verbose output to the terminal");
}