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 2.1-3.0 and Python 3.5-3.7 and is hosted on github.

Note that version 0.4.0 also supports Django 1.11 - 2.0.

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

Uploaded Source

Built Distributions

django_docopt_command-1.0.0-py3.7.egg (3.1 kB view details)

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-docopt-command-1.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for django-docopt-command-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9c61a8302ee021bd895a11a5648805cedae94d5b3862bf0a0a9f1abd6a0d6742
MD5 621397d7d8538bbf978699e6991d246c
BLAKE2b-256 e602eb64dd16baea4f86988404f50aa2e868a398c155153b1327a5ea7a4c0ed3

See more details on using hashes here.

File details

Details for the file django_docopt_command-1.0.0-py3.7.egg.

File metadata

  • Download URL: django_docopt_command-1.0.0-py3.7.egg
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for django_docopt_command-1.0.0-py3.7.egg
Algorithm Hash digest
SHA256 96e89605c62e2d88566f906bd65cae50eb9735471148634b3ee2bb01ff8d3330
MD5 5156447fde8144560de029073083fc9a
BLAKE2b-256 29dc090e16a8a3cc688b5aa616b080574117921eb6077f6e5d707f8a866eca3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_docopt_command-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for django_docopt_command-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6002f4d8a80cce279a3df2cddd3386d6402dc9ce20bd67edbbc2f34a369b77fd
MD5 bb83bfed608b68395a30ab6fd7a44283
BLAKE2b-256 e3be7944522ef82cef2d9bc87161917708ac019f9c94bcaf4c7122f0630afb7a

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