Skip to content

Commit f9f200c

Browse files
committed
Sync CLI options with Readme
1 parent 83ec9e9 commit f9f200c

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

README.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,26 @@ $ pip install pydantic-to-typescript
1616

1717
---
1818

19-
### CLI
20-
21-
| Prop | Description |
22-
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23-
| ‑‑module | name or filepath of the python module you would like to convert. All the pydantic models within it will be converted to typescript interfaces. Discoverable submodules will also be checked. |
24-
| ‑‑output | name of the file the typescript definitions should be written to. Ex: './frontend/apiTypes.ts' |
25-
| ‑‑exclude | name of a pydantic model which should be omitted from the resulting typescript definitions. This option can be defined multiple times, ex: `--exclude Foo --exclude Bar` to exclude both the Foo and Bar models from the output. |
26-
| ‑‑json2ts‑cmd | optional, the command used to invoke json2ts. The default is 'json2ts'. Specify this if you have it installed locally (ex: 'yarn json2ts') or if the exact path to the executable is required (ex: /myproject/node_modules/bin/json2ts) |
19+
### CLI options
20+
21+
`--module MODULE`
22+
: name or filepath of the python module you would like to convert. \
23+
All the pydantic models within it will be converted to typescript interfaces. \
24+
Discoverable submodules will also be checked.
25+
26+
`--output OUTPUT`
27+
: name of the file the typescript definitions should be written to. Ex: './frontend/apiTypes.ts'
28+
29+
`--exclude EXCLUDE`
30+
: name of a pydantic model which should be omitted from the resulting typescript definitions. \
31+
This option can be defined multiple times,
32+
ex: `--exclude Foo --exclude Bar` to exclude both the Foo and Bar models from the output. \
33+
34+
`--json2ts-cmd JSON2TS_CMD`
35+
: optional, the command used to invoke json2ts. \
36+
Specify this if you have json-schema-to-typescript installed locally (ex: 'yarn json2ts')
37+
or if the exact path to the executable is required (ex: /myproject/node_modules/bin/json2ts). \
38+
(default: json2ts)
2739

2840
---
2941

pydantic2ts/cli/script.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -240,27 +240,30 @@ def parse_cli_args(args: List[str] = None) -> argparse.Namespace:
240240
)
241241
parser.add_argument(
242242
"--module",
243-
help="name or filepath of the python module.\n"
243+
help="name or filepath of the python module you would like to convert.\n"
244+
"All the pydantic models within it will be converted to typescript interfaces.\n"
244245
"Discoverable submodules will also be checked.",
245246
)
246247
parser.add_argument(
247248
"--output",
248-
help="name of the file the typescript definitions should be written to.",
249+
help="name of the file the typescript definitions should be written to. Ex: './frontend/apiTypes.ts'",
249250
)
250251
parser.add_argument(
251252
"--exclude",
252253
action="append",
253254
default=[],
254-
help="name of a pydantic model which should be omitted from the results.\n"
255-
"This option can be defined multiple times.",
255+
help="name of a pydantic model which should be omitted from the resulting typescript definitions.\n"
256+
"This option can be defined multiple times,\n"
257+
"ex: `--exclude Foo --exclude Bar` to exclude both the Foo and Bar models from the output.",
256258
)
257259
parser.add_argument(
258260
"--json2ts-cmd",
259261
dest="json2ts_cmd",
260262
default="json2ts",
261-
help="path to the json-schema-to-typescript executable.\n"
262-
"Provide this if it's not discoverable or if it's only installed locally (example: 'yarn json2ts').\n"
263-
"(default: json2ts)",
263+
help="optional, the command used to invoke json2ts.\n"
264+
"Specify this if you have json-schema-to-typescript installed locally (ex: 'yarn json2ts')\n"
265+
"or if the exact path to the executable is required (ex: /myproject/node_modules/bin/json2ts).\n"
266+
"(default: json2ts)",
264267
)
265268
return parser.parse_args(args)
266269

0 commit comments

Comments
 (0)