Skip to main content

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

Project description

Django docopt command

Build Status Version

Coverage Status Requirements Status

License

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.11-2.2 and Python 2.7, 3.5-3.7 and is hosted on github.

Note that version 0.3.0 also supports Django 1.8 - 1.10.

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):
		option1 = arguments['option1']
		option2 = arguments['option2']

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.5.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distributions

django_docopt_command-0.5.0-py3.6.egg (3.2 kB view details)

Uploaded Source

django_docopt_command-0.5.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-docopt-command-0.5.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.16

File hashes

Hashes for django-docopt-command-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0f66fc84be7fd8175a6761f3fb217d925a3d9620cec981871a1be8d7337836a6
MD5 5e25d89cde81872045e16dca024385f0
BLAKE2b-256 977a33a0f026beb812fd122972cc3280db3fd6a28078c9390bd650fef750a5a2

See more details on using hashes here.

File details

Details for the file django_docopt_command-0.5.0-py3.6.egg.

File metadata

  • Download URL: django_docopt_command-0.5.0-py3.6.egg
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.16

File hashes

Hashes for django_docopt_command-0.5.0-py3.6.egg
Algorithm Hash digest
SHA256 a43a358e0d13be10f605000598af53eae561bbeef71a4e62140bcd3c32f691ca
MD5 38d34396fd7fb11498df7c43c04f9bde
BLAKE2b-256 b483f3b4f7e17ce13b0f0c6023cf53943eca4a2729828b2ec98925ab80871a65

See more details on using hashes here.

File details

Details for the file django_docopt_command-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: django_docopt_command-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.16

File hashes

Hashes for django_docopt_command-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afcb3d9bab71f1fd981ac369de84abbc32b9f4c98ab30d69d8341d1891f623c4
MD5 8e50bd0bc11910e22f8d49a35f13ff1e
BLAKE2b-256 640aaf68aa162306ce4a7349319ee3b12373bb788367285f5289012e516bd997

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