Skip to content

Commit 41b841c

Browse files
authored
feat: simplify parsing variadic arg (and support -t X Y and -t X -t Y patterns) (#2416)
1 parent ce1a670 commit 41b841c

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

ts-json-schema-generator.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,14 @@ import pkg from "./package.json";
1111

1212
const args = new Command()
1313
.option("-p, --path <path>", "Source file path")
14-
.option(
15-
"-t, --type <name>",
16-
"Type name (can be passed multiple times)",
17-
(value: string, previous: string[] | undefined) => {
18-
if (previous) {
19-
return previous.concat(value);
20-
}
21-
return [value];
22-
},
23-
)
14+
.option("-t, --type <name...>", "Type name(s)")
2415
.option("-i, --id <name>", "$id for generated schema")
2516
.option("-f, --tsconfig <path>", "Custom tsconfig.json path")
2617
.addOption(
2718
new Option("-e, --expose <expose>", "Type exposing").choices(["all", "none", "export"]).default("export"),
2819
)
2920
.addOption(
30-
new Option("-j, --jsDoc <extended>", "Read JsDoc annotations")
21+
new Option("-j, --jsDoc <extended>", "Read JSDoc annotations")
3122
.choices(["none", "basic", "extended"])
3223
.default("extended"),
3324
)

0 commit comments

Comments
 (0)