Render CLI arguments (sub-commands friendly) defined by the argparse module. For live demo checkout the documentation of tox, python-build and mdpo.
python -m pip install sphinx-argparse-cli
# just add it to your list of extensions to load within conf.py
extensions = ["sphinx_argparse_cli"]
Within the reStructuredText files use the sphinx_argparse_cli
directive that takes, at least, two arguments:
Name | Description |
---|---|
module | the module path to where the parser is defined |
func | the module path to where the parser is defined |
prog | (optional) the module path to where the parser is defined |
title | (optional) when provided, overwrites the <prog> - CLI interface title added by default and when empty, will not be included |
usage_width | (optional) how large should usage examples be - defaults to 100 character |
For example:
.. sphinx_argparse_cli::
:module: a_project.cli
:func: build_parser
:prog: my-cli-program