22 lines
393 B
TypeScript
22 lines
393 B
TypeScript
import util from "node:util";
|
|
|
|
const options = {
|
|
help: {
|
|
type: "boolean",
|
|
default: true,
|
|
run() {
|
|
console.log(
|
|
[
|
|
"Available options:",
|
|
...Object.keys(options).map((option) => ` --${option}`),
|
|
].join("\n"),
|
|
);
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
const args = util.parseArgs({ options });
|
|
|
|
if (args.values.help) {
|
|
await options.help.run();
|
|
}
|