Examples

Live demos

Base parser rendering

Example CLI showing how sphinx-autodoc-argparse renders parsers.

Usage

usage: myapp [-h] [--verbose] [--config PATH]
             {mysubcommand,myothersubcommand} ...

Options

--verbose, -v

Enable verbose output.

Default
False
--config PATH

Path to configuration file.

Default
pyproject.toml

Sub-commands

mysubcommand

Run the primary task.

Execute the primary task with configurable output.

Usage

usage: myapp mysubcommand [-h] [--output DIR] [--format {text,json}] [--clean]

Options

--output, -o DIR

Output directory.

Default
build
--format

Output format.

Default
text
Choices
text, json
--clean

Remove previous output first.

Default
False

myothersubcommand

Run a secondary task.

Execute a secondary task with network options.

Usage

usage: myapp myothersubcommand [-h] [--port PORT] [--host HOST]

Options

--port

Port number.

Default
8000
Type
int
--host

Host to bind to.

Default
localhost

Subcommand rendering

Drill into a single subcommand with :path::

Execute the primary task with configurable output.

Usage

usage: myapp mysubcommand [-h] [--output DIR] [--format {text,json}] [--clean]

Options

--output, -o DIR

Output directory.

Default
build
--format

Output format.

Default
text
Choices
text, json
--clean

Remove previous output first.

Default
False

Inline roles

The exemplar layer also registers live inline roles for CLI prose: myapp, --verbose, json, DIR, and text.