json
This commit is contained in:
parent
e4202f7fee
commit
aac345833b
1 changed files with 11 additions and 0 deletions
11
main.ts
11
main.ts
|
@ -118,6 +118,9 @@ const options = {
|
||||||
await library.archive(args.values["out-dir"]!);
|
await library.archive(args.values["out-dir"]!);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
json: {
|
||||||
|
type: "boolean",
|
||||||
|
},
|
||||||
help: {
|
help: {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
short: "h",
|
short: "h",
|
||||||
|
@ -134,6 +137,14 @@ const options = {
|
||||||
|
|
||||||
const args = util.parseArgs({ options });
|
const args = util.parseArgs({ options });
|
||||||
|
|
||||||
|
if (args.values.json) {
|
||||||
|
console.dir = function dir(arrayOrObject) {
|
||||||
|
for (const obj of [arrayOrObject].flat()) {
|
||||||
|
console.log(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
for (const option of Object.keys(options)) {
|
for (const option of Object.keys(options)) {
|
||||||
if (args.values[option] && typeof options[option].run === "function") {
|
if (args.values[option] && typeof options[option].run === "function") {
|
||||||
await options[option].run();
|
await options[option].run();
|
||||||
|
|
Loading…
Add table
Reference in a new issue