Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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.2 - 3.1 and Python 3.5 - 3.8 and is hosted on github.

Note that version 1.0.0 also supports Django 2.1 and version 0.5.0 supports Django 1.11 and Django 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.

Metadata

Release files for django-docopt-command 1.1.0

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

Source distribution (sdist)

Source distribution for django-docopt-command 1.1.0
File Size Uploaded
django-docopt-command-1.1.0.tar.gz 3.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for django-docopt-command 1.1.0
File Interpreter ABI Platform
django_docopt_command-1.1.0-py3.8.egg Legacy Egg format - - Details
django_docopt_command-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / django-docopt-command-1.1.0.tar.gz

Download URL django-docopt-command-1.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ed52c2ab73c4facd353edc6a70b54d4054e9ec0484c9b58a30eae702da86a0f6
BLAKE2b-256 checksum
How to use checksums
e16dc51cb829d25ec2090cd3f286b5d6c9a95200fe277fa79be9d3c691acd2e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / django_docopt_command-1.1.0-py3.8.egg

Download URL django_docopt_command-1.1.0-py3.8.egg
Size 3.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
8db9b4814ba1cd1bd899ea484e8d3f42a92b67c4a6ff0dfa861bffbfd6cf35e6
BLAKE2b-256 checksum
How to use checksums
59fdd347ac5aa881ba86a499cfbd008e4a7113099df6ca5351705ce03522b77f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / django_docopt_command-1.1.0-py3-none-any.whl

Download URL django_docopt_command-1.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aee42da41adfb1ac263eeae5c118178a75538ef829ab1cb7a10b6f87a7c8579a
BLAKE2b-256 checksum
How to use checksums
7b358446c743dd14e8ea404732eedc8100763a0fc1f72e7724768371749051cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
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