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.0.tar.gz (2.7 kB view hashes)

Uploaded Source

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