{"id":17035834,"url":"https://github.com/mbraak/django-docopt-command","last_synced_at":"2025-04-12T00:32:45.736Z","repository":{"id":10921179,"uuid":"13222253","full_name":"mbraak/django-docopt-command","owner":"mbraak","description":"Django-docopt-command allows you to write Django manage.py commands using the docopt library","archived":false,"fork":false,"pushed_at":"2024-05-21T05:26:14.000Z","size":183,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T20:14:01.901Z","etag":null,"topics":["django","django-docopt-command","docopt","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbraak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-30T17:43:53.000Z","updated_at":"2024-02-26T10:03:16.000Z","dependencies_parsed_at":"2022-08-30T01:02:21.375Z","dependency_job_id":null,"html_url":"https://github.com/mbraak/django-docopt-command","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbraak%2Fdjango-docopt-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbraak%2Fdjango-docopt-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbraak%2Fdjango-docopt-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbraak%2Fdjango-docopt-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbraak","download_url":"https://codeload.github.com/mbraak/django-docopt-command/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501447,"owners_count":21114674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-docopt-command","docopt","python"],"created_at":"2024-10-14T08:48:17.408Z","updated_at":"2025-04-12T00:32:45.710Z","avatar_url":"https://github.com/mbraak.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django docopt command\n\n[![Build Status](https://img.shields.io/travis/mbraak/django-docopt-command.svg?style=for-the-badge)](https://travis-ci.org/mbraak/django-docopt-command) [![Version](https://img.shields.io/pypi/v/django-docopt-command.svg?colorB=brightgreen\u0026style=for-the-badge)](https://pypi.python.org/pypi/django-docopt-command/)\n\n[![Coverage Status](https://img.shields.io/coveralls/mbraak/django-docopt-command.svg?style=for-the-badge)](https://coveralls.io/r/mbraak/django-docopt-command?branch=master) [![Requirements Status](https://img.shields.io/requires/github/mbraak/django-docopt-command.svg?style=for-the-badge)](https://requires.io/github/mbraak/django-docopt-command/requirements/?branch=master)\n\n[![License](https://img.shields.io/pypi/l/django-docopt-command.svg?style=for-the-badge\u0026colorB=brightgreen)](https://pypi.python.org/pypi/django-docopt-command/)\n\nDjango-docopt-command allows you to write [Django](https://www.djangoproject.com) [manage.py](https://docs.djangoproject.com/en/dev/howto/custom-management-commands/) commands using the [docopt](http://www.docopt.org) library. This means that you can define commands using usage strings.\n\nReferences:\n\n* [Django](https://www.djangoproject.com): The Web framework for perfectionists with deadlines\n* [The docopt library](http://www.docopt.org): Command-line interface description language\n* [Writing custom django-admin commands](https://docs.djangoproject.com/en/dev/howto/custom-management-commands/)\n\n```python\nclass Command(DocOptCommand):\n\t# This usage string defines the command options:\n\tdocs = \"Usage: command \u003coption1\u003e \u003coption2\u003e [--flag1]\"\n\n\tdef handle_docopt(self, arguments):\n\t\t# arguments contains a dictionary with the options\n\t\tpass\n```\n\nDjango-docopt-command is tested with Django 2.2 - 3.1 and Python 3.5 - 3.8 and is hosted on [github](https://github.com/mbraak/django-docopt-command).\n\nNote that version 1.0.0 also supports Django 2.1 and version 0.5.0 supports Django 1.11 and Django 2.0.\n\n### Example\n\nSee the *testproject/docopt_example* in the django-docopt-command github repository.\n\n## Usage\n\nInstall django-docopt-command.\n\n```\npip install django-docopt-command\n```\n\n**Step 1 - management command**\n\nWrite a Django custom management command, as described in [Writing custom django-admin commands](https://docs.djangoproject.com/en/dev/howto/custom-management-commands/).\n\n**Step 2 - inherit from DocOptCommand**\n\n```python\nclass Command(DocOptCommand):\n\tpass\n```\n\n**Step 3 - add a docs string**\n\n```python\nclass Command(DocOptCommand):\n\tdocs = \"Usage: command \u003coption1\u003e \u003coption2\u003e [--flag1]\"\n```\n\n**Step 4 - override handle_docopt**\n\n```python\nclass Command(DocOptCommand):\n\tdocs = \"Usage: command \u003coption1\u003e \u003coption2\u003e [--flag1]\"\n\n\tdef handle_docopt(self, arguments):\n\t\toption1 = arguments['option1']\n\t\toption2 = arguments['option2']\n```\n\n## License\n\nDjango-docopt-command is licensed under the Apache 2.0 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbraak%2Fdjango-docopt-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbraak%2Fdjango-docopt-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbraak%2Fdjango-docopt-command/lists"}