Skip to main content

Dispatch from command-line arguments to functions

Experimental.

Example

"""Run something in development or production mode.

Usage: run.py --development <host> <port>
       run.py --production <host> <port>
       run.py remote add <item>
       run.py remote delete <item>

"""
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')


@dispatch.on('items', 'add')
def items_add(item, **kwargs):
    print('adding item...')


@dispatch.on('items', 'delete')
def items_delete(item, **kwargs):
    print('deleting item...')


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

Metadata

Release files for docopt-dispatch 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docopt-dispatch 0.0.2
File Size Uploaded Provenance
docopt-dispatch-0.0.2.tar.gz 2.9 kB Without provenance Details

Release files / docopt-dispatch-0.0.2.tar.gz

Download URL docopt-dispatch-0.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0a971e0bfa1a0854ba4ab97b90361069498157c5600c6e8460decd656b472fd9
BLAKE2b-256 checksum
How to use checksums
7a10201addb0618cfdd41b64646acc4322259d71dad9333fdb550846674945d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for docopt-dispatch 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page