Skip to content

Render CLI arguments (sub-commands friendly) defined by the argparse module.

License

Notifications You must be signed in to change notification settings

tox-dev/sphinx-argparse-cli

Repository files navigation

sphinx-argparse-cli

PyPI PyPI - Implementation PyPI - Python Version PyPI - Downloads PyPI - License check Code style: black

Render CLI arguments (sub-commands friendly) defined by the argparse module. For live demo checkout the documentation of tox, python-build and mdpo.

installation

python -m pip install sphinx-argparse-cli

enable in your conf.py

# just add it to your list of extensions to load within conf.py
extensions = ["sphinx_argparse_cli"]

use

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

About

Render CLI arguments (sub-commands friendly) defined by the argparse module.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages