An alternative to using docopt-ng, or just docopt, may be docopt-dispatch. It makes it largely unnecessary to implement argument dispatching logic on your own and hence renders the Docopt CLI example source code more readable.
Example
"""Awesome CLI.
...
Usage:
awesome (-h | --help | --version)
awesome login --user <user> --pass <pass>
Commands:
login Authorize a user with username and password
"""
from docopt_dispatch import dispatch
def main():
"""The CLI entrypoint."""
dispatch(__doc__, version=__version__)
@dispatch.on("login")
def login_command(**kwargs):
"""Authorize a user with username and password."""
username = kwargs["user"]
password = kwargs["pass"]
...
An alternative to using docopt-ng, or just docopt, may be docopt-dispatch. It makes it largely unnecessary to implement argument dispatching logic on your own and hence renders the Docopt CLI example source code more readable.
Example
Related