Skip to main content

Dispatch from command-line arguments to functions

Project description

Experimental.

Example

"""Run something in development or production mode.

Usage: run-something.py (--development | --production) <host> <port>

"""
from docopt_dispatch import dispatch


@dispatch.on('--development')
def development(host, port, **kwargs):
    print('in *development* mode')


@dispatch.on('--production')
def development(host, port, **kwargs):
    print('in *production* mode')


if __name__ == '__main__':
    dispatch(__doc__)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docopt-dispatch-0.0.1.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file docopt-dispatch-0.0.1.tar.gz.

File metadata

File hashes

Hashes for docopt-dispatch-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9eb3ea81072885a5ce6f9e997fbc06161d60ab6b783dd4487bf80ef8fda5c737
MD5 d74b0d14787f35a9b81779ac8d7e3425
BLAKE2b-256 0389f05204befd4ec3cfbc8454b2d59c7eab2d618e47ad57b67ce5826543410f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page