Skip to main content

Django-docopt-command allows you to write Django manage.py commands using the docopt library

Project description

Build Status

Django-docopt-command allows you to write Django manage.py commands using the docopt library. This means that you can define commands using usage strings.

References:

class Command(DocOptCommand):
    # This usage string defines the command options:
    docs = "Usage: command <option1> <option2> [--flag1]"

    def handle_docopt(self, arguments):
        # arguments contains a dictionary with the options
        pass

Django-docopt-command is tested with Django 1.4-1.6 and Python 2.6, 2.7 and 3.3 and is hosted on github.

Example

See the testproject/docopt_example in the django-docopt-command github repository.

Usage

Install django-docopt-command.

pip install django-docopt-command

Step 1 - management command

Write a Django custom management command, as described in Writing custom django-admin commands.

Step 2 - inherit from DocOptCommand

class Command(DocOptCommand):
    pass

Step 3 - add a docs string

class Command(DocOptCommand):
    docs = "Usage: command <option1> <option2> [--flag1]"

Step 4 - override handle_docopt

class Command(DocOptCommand):
    docs = "Usage: command <option1> <option2> [--flag1]"

    def handle_docopt(self, arguments):
        pass

License

Django-docopt-command is licensed under the Apache 2.0 License.

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

django-docopt-command-0.1.0.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file django-docopt-command-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-docopt-command-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a807a9386899991a7cd16b77301de6080e3c45d922ed9c0f54d60ecb886f4e36
MD5 0c54e0203bee11cef41e4402be73b58f
BLAKE2b-256 4aaf7f63a8871c9983ff4a507ed5a2fb54b4cb20ce52d92a6dee3eb18bc76358

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