autodocument argparser
This commit is contained in:
parent
486f4a50dc
commit
ca450d667a
@ -43,6 +43,7 @@ extensions = [
|
||||
"sphinx.ext.graphviz",
|
||||
"sphinx.ext.inheritance_diagram",
|
||||
"sphinx.ext.imgconverter",
|
||||
"sphinxarg.ext",
|
||||
"sphinxcontrib.datatemplates",
|
||||
"sphinxcontrib.spelling",
|
||||
]
|
||||
|
@ -24,6 +24,7 @@ are relevant to the user of this library.
|
||||
user/printers
|
||||
user/raspi
|
||||
user/usage
|
||||
user/cli-user
|
||||
user/barcode
|
||||
|
||||
Printer profiles
|
||||
|
@ -11,5 +11,6 @@ python-barcode>=0.11.0,<1
|
||||
importlib-metadata
|
||||
importlib_resources
|
||||
sphinxcontrib.datatemplates
|
||||
sphinx-argparse
|
||||
sphinx-autodoc-typehints
|
||||
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():
|
||||
"""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.
|
||||
"""
|
||||
def generate_parser() -> argparse.ArgumentParser:
|
||||
"""Generate an argparse parser."""
|
||||
parser = argparse.ArgumentParser(
|
||||
description="CLI for python-escpos",
|
||||
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)
|
||||
|
||||
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
|
||||
if "argcomplete" in globals():
|
||||
argcomplete.autocomplete(parser)
|
||||
|
Loading…
x
Reference in New Issue
Block a user