Skip to content

Commit e43c96f

Browse files
committed
Update README
- Adds recommendation to use pipx (closes #20) - Adds generated usage.md from typer-cli
1 parent e77bab8 commit e43c96f

File tree

3 files changed

+63
-4
lines changed

3 files changed

+63
-4
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Additionally, because this generator is written in Python, it should be more acc
1919
using it (Python developers).
2020

2121
## Installation
22-
`pip install openapi-python-client`
22+
I recommend you install with [pipx](https://pipxproject.github.io/pipx/) so you don't conflict with any other packages
23+
you might have: `pipx install openapi-python-client`.
24+
25+
You can install with normal pip if you want to though: `pipx install openapi-python-client`
2326

2427
Then, if you want tab completion: `openapi-python-client --install-completion`
2528

@@ -34,6 +37,8 @@ get an error.
3437
### Update an existing client
3538
`openapi-python-client update --url https://my.api.com/openapi.json`
3639

40+
> For more usage details run `openapi-python-client --help` or read [usage](usage.md)
41+
3742
## What You Get
3843
1. A `pyproject.toml` file with some basic metadata intended to be used with [Poetry].
3944
1. A `README.md` you'll most definitely need to update with your project's details

openapi_python_client/cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
app = typer.Typer()
77

88

9-
def _version_callback(value: bool):
9+
def _version_callback(value: bool) -> None:
1010
from openapi_python_client import __version__
1111

1212
if value:
@@ -15,9 +15,9 @@ def _version_callback(value: bool):
1515

1616

1717
# noinspection PyUnusedLocal
18-
@app.callback()
18+
@app.callback(name="openapi-python-client")
1919
def cli(
20-
version: bool = typer.Option(False, "--version", callback=_version_callback),
20+
version: bool = typer.Option(False, "--version", callback=_version_callback, help="Print the version and exit"),
2121
) -> None:
2222
""" Generate a Python client from an OpenAPI JSON document """
2323
pass

usage.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# `openapi-python-client`
2+
3+
Generate a Python client from an OpenAPI JSON document
4+
5+
**Usage**:
6+
7+
```console
8+
$ openapi-python-client [OPTIONS] COMMAND [ARGS]...
9+
```
10+
11+
**Options**:
12+
13+
* `--version`: Print the version and exit
14+
* `--install-completion`: Install completion for the current shell.
15+
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
16+
* `--help`: Show this message and exit.
17+
18+
**Commands**:
19+
20+
* `generate`: Generate a new OpenAPI Client library
21+
* `update`: Update an existing OpenAPI Client library
22+
23+
## `openapi-python-client generate`
24+
25+
Generate a new OpenAPI Client library
26+
27+
**Usage**:
28+
29+
```console
30+
$ openapi-python-client generate [OPTIONS]
31+
```
32+
33+
**Options**:
34+
35+
* `--url TEXT`: A URL to read the JSON from
36+
* `--path PATH`: A path to the JSON file
37+
* `--help`: Show this message and exit.
38+
39+
## `openapi-python-client update`
40+
41+
Update an existing OpenAPI Client library
42+
43+
**Usage**:
44+
45+
```console
46+
$ openapi-python-client update [OPTIONS]
47+
```
48+
49+
**Options**:
50+
51+
* `--url TEXT`: A URL to read the JSON from
52+
* `--path PATH`: A path to the JSON file
53+
* `--help`: Show this message and exit.
54+

0 commit comments

Comments
 (0)