skip to navigation
skip to content

Not Logged In

django-docopt-command 0.2.0

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

Latest Version: 0.2.1

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.7 and Python 2.6, 2.7, 3.3 and 3.4 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.

 
File Type Py Version Uploaded on Size
django-docopt-command-0.2.0.tar.gz (md5) Source 2014-08-28 2KB
django_docopt_command-0.2.0-py2-none-any.whl (md5) Python Wheel 2.7 2014-08-28 3KB
django_docopt_command-0.2.0-py2.7.egg (md5) Python Egg 2.7 2014-08-28 3KB
  • Downloads (All Versions):
  • 55 downloads in the last day
  • 356 downloads in the last week
  • 1106 downloads in the last month