s3si.ts/s3si.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-10-21 07:09:30 -04:00
import { App, DEFAULT_OPTS } from "./src/app.ts";
import { showError } from "./src/utils.ts";
import { flags } from "./deps.ts";
2022-10-18 09:16:51 -04:00
const parseArgs = (args: string[]) => {
const parsed = flags.parse(args, {
2022-10-20 09:45:59 -04:00
string: ["profilePath", "exporter"],
2022-10-20 10:05:58 -04:00
boolean: ["help", "noProgress"],
2022-10-18 09:16:51 -04:00
alias: {
"help": "h",
2022-10-20 09:45:59 -04:00
"profilePath": ["p", "profile-path"],
"exporter": ["e"],
2022-10-20 10:05:58 -04:00
"noProgress": ["n", "no-progress"],
2022-10-20 09:45:59 -04:00
},
2022-10-18 09:16:51 -04:00
});
return parsed;
};
2022-10-22 09:00:45 -04:00
const opts = parseArgs(Deno.args);
if (opts.help) {
console.log(
`Usage: deno run -A ${Deno.mainModule} [options]
Options:
--profile-path <path>, -p Path to config file (default: ./profile.json)
--exporter <exporter>, -e Exporter list to use (default: stat.ink)
Multiple exporters can be separated by commas
(e.g. "stat.ink,file")
--no-progress, -n Disable progress bar
--help Show this help message and exit`,
);
Deno.exit(0);
}
2022-10-18 09:16:51 -04:00
const app = new App({
...DEFAULT_OPTS,
2022-10-22 09:00:45 -04:00
...opts,
2022-10-18 09:16:51 -04:00
});
await showError(app.run());