autodocument argparser
This commit is contained in:
parent
486f4a50dc
commit
ca450d667a
@ -43,6 +43,7 @@ extensions = [
|
|||||||
"sphinx.ext.graphviz",
|
"sphinx.ext.graphviz",
|
||||||
"sphinx.ext.inheritance_diagram",
|
"sphinx.ext.inheritance_diagram",
|
||||||
"sphinx.ext.imgconverter",
|
"sphinx.ext.imgconverter",
|
||||||
|
"sphinxarg.ext",
|
||||||
"sphinxcontrib.datatemplates",
|
"sphinxcontrib.datatemplates",
|
||||||
"sphinxcontrib.spelling",
|
"sphinxcontrib.spelling",
|
||||||
]
|
]
|
||||||
|
@ -24,6 +24,7 @@ are relevant to the user of this library.
|
|||||||
user/printers
|
user/printers
|
||||||
user/raspi
|
user/raspi
|
||||||
user/usage
|
user/usage
|
||||||
|
user/cli-user
|
||||||
user/barcode
|
user/barcode
|
||||||
|
|
||||||
Printer profiles
|
Printer profiles
|
||||||
|
@ -11,5 +11,6 @@ python-barcode>=0.11.0,<1
|
|||||||
importlib-metadata
|
importlib-metadata
|
||||||
importlib_resources
|
importlib_resources
|
||||||
sphinxcontrib.datatemplates
|
sphinxcontrib.datatemplates
|
||||||
|
sphinx-argparse
|
||||||
sphinx-autodoc-typehints
|
sphinx-autodoc-typehints
|
||||||
pycups
|
pycups
|
||||||
|
10
doc/user/cli-user.rst
Normal file
10
doc/user/cli-user.rst
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CLI
|
||||||
|
===
|
||||||
|
|
||||||
|
:Last Reviewed: 2023-09-25
|
||||||
|
|
||||||
|
Documentation of the command line interface, callable with ``python-escpos``.
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: escpos.cli.generate_parser
|
||||||
|
:prog: python-escpos
|
@ -487,12 +487,8 @@ def print_extended_information() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def generate_parser() -> argparse.ArgumentParser:
|
||||||
"""Handle main entry point of CLI script.
|
"""Generate an argparse parser."""
|
||||||
|
|
||||||
Handles loading of configuration and creating and processing of command
|
|
||||||
line arguments. Called when run from a CLI.
|
|
||||||
"""
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="CLI for python-escpos",
|
description="CLI for python-escpos",
|
||||||
epilog="Printer configuration is defined in the python-escpos config"
|
epilog="Printer configuration is defined in the python-escpos config"
|
||||||
@ -563,6 +559,17 @@ def main():
|
|||||||
)
|
)
|
||||||
parser_command_version_extended.set_defaults(version_extended=True)
|
parser_command_version_extended.set_defaults(version_extended=True)
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Handle main entry point of CLI script.
|
||||||
|
|
||||||
|
Handles loading of configuration and creating and processing of command
|
||||||
|
line arguments. Called when run from a CLI.
|
||||||
|
"""
|
||||||
|
parser = generate_parser()
|
||||||
|
|
||||||
# hook in argcomplete
|
# hook in argcomplete
|
||||||
if "argcomplete" in globals():
|
if "argcomplete" in globals():
|
||||||
argcomplete.autocomplete(parser)
|
argcomplete.autocomplete(parser)
|
||||||
|
1
tox.ini
1
tox.ini
@ -33,6 +33,7 @@ changedir = doc
|
|||||||
deps = sphinx>=7.2.3
|
deps = sphinx>=7.2.3
|
||||||
setuptools_scm
|
setuptools_scm
|
||||||
python-barcode
|
python-barcode
|
||||||
|
sphinx-argparse
|
||||||
sphinxcontrib-spelling>=8.0.0
|
sphinxcontrib-spelling>=8.0.0
|
||||||
sphinxcontrib.datatemplates
|
sphinxcontrib.datatemplates
|
||||||
sphinx-autodoc-typehints
|
sphinx-autodoc-typehints
|
||||||
|
Loading…
x
Reference in New Issue
Block a user