{ "info": { "author": "Lari Rasku", "author_email": "raskug@lavabit.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Utilities" ], "description": "WARNING: The `upcoming 0.7.0 release of docopts\r\n`_ will feature a completely\r\ndifferent user interface. Prepare for script breakage.\r\n\r\n================================================================================\r\n docopts\r\n================================================================================\r\n--------------------------------------------------------------------------------\r\n shell interface for docopt, the CLI description language\r\n--------------------------------------------------------------------------------\r\n:Author: `Lari Rasku `_\r\n:Date: 2013-02-07\r\n:Copyright: `MIT `_\r\n:Version: 0.6.1+fix\r\n:Manual section: 1\r\n\r\nSYNOPSIS\r\n================================================================================\r\n``docopts`` [*options*] ``-h`` *msg* : [*argv*...]\r\n\r\nDESCRIPTION\r\n================================================================================\r\n``docopts`` parses the command line argument vector *argv* according to the\r\n`docopt `_ string *msg* and echoes the results to standard\r\noutput as a snippet of Bash source code. Passing this snippet as an argument to\r\n`eval(1) `_ is sufficient for handling the CLI needs of\r\nmost scripts.\r\n\r\nIf *argv* matches one of the usage patterns defined in *msg*, ``docopts``\r\ngenerates code for storing the parsed arguments as Bash variables. As most\r\ncommand line argument names are not valid Bash identifiers, some name mangling\r\nwill take place:\r\n\r\n* ````: ``Angle_Brackets``\r\n* ``UPPER-CASE``: ``UPPER_CASE``\r\n* ``--Long-Option``: ``Long_Option``\r\n* ``-S``: ``S``\r\n\r\nIf one of the argument names cannot be mangled into a valid Bash identifier,\r\nor two argument names map to the same variable name, ``docopt`` will exit with\r\nan error, and you should really rethink your CLI. The ``--`` and ``-``\r\ncommands will not be stored.\r\n\r\nAlternatively, ``docopts`` can be invoked with the ``-A `` option, which\r\nstores the parsed arguments as fields of a Bash 4 associative array called\r\n```` instead. However, as Bash does not natively support nested arrays,\r\nthey are faked for repeatable arguments with the following access syntax::\r\n\r\n ${args[ARG,#]} # the number of arguments to ARG\r\n ${args[ARG,0]} # the first argument to ARG\r\n ${args[ARG,1]} # the second argument to ARG, etc.\r\n\r\nThe arguments are stored as follows:\r\n\r\n* Non-repeatable, valueless arguments: ``true`` if found, ``false`` if not\r\n* Repeatable valueless arguments: the count of their instances in *argv*\r\n* Non-repeatable arguments with values: the value as a string if found,\r\n the empty string if not\r\n* Repeatable arguments with values: a Bash array of the parsed values\r\n\r\nUnless the ``--no-help`` option is given, ``docopts`` handles the ``--help``\r\nand ``--version`` options and their possible aliases specially,\r\ngenerating code for printing the relevant message to standard output and\r\nterminating successfully if either option is encountered when parsing *argv*.\r\nNote however that this also requires listing the relevant option in\r\n*msg* and, in ``--version``'s case, invoking ``docopts`` with the ``--version``\r\noption.\r\n\r\nIf *argv* does not match any usage pattern in *msg*, ``docopts`` will generate\r\ncode for exiting the program with status 64 (``EX_USAGE`` in\r\n`sysexits(3) `_) and printing a diagnostic error\r\nmessage.\r\n\r\nOPTIONS\r\n================================================================================\r\n -h , --help= The help message in docopt format.\r\n If - is given, read the help message from\r\n standard input.\r\n If no argument is given, print docopts's own\r\n help message and quit.\r\n -V , --version= A version message.\r\n If - is given, read the version message from\r\n standard input. If the help message is also\r\n read from standard input, read it first.\r\n If no argument is given, print docopts's own\r\n version message and quit.\r\n -O, --options-first Disallow interspersing options and positional\r\n arguments: all arguments starting from the\r\n first one that does not begin with a dash will\r\n be treated as positional arguments.\r\n -H, --no-help Don't handle --help and --version specially.\r\n -A Export the arguments as a Bash 4.x associative\r\n array called .\r\n -s , --separator= The string to use to separate the help message\r\n from the version message when both are given\r\n via standard input. [default: ----]\r\n\r\nEXAMPLES\r\n================================================================================\r\nRead the help and version messages from standard input::\r\n\r\n eval \"$(docopts -V - -h - : \"$@\" <...\r\n \r\n --verbose Generate verbose messages.\r\n --help Show help options.\r\n --version Print program version.\r\n ----\r\n rock 0.1.0\r\n Copyright (C) 200X Thomas Light\r\n License RIT (Robot Institute of Technology)\r\n This is free software: you are free to change and redistribute it.\r\n There is NO WARRANTY, to the extent permitted by law.\r\n EOF\r\n )\"\r\n \r\n if $verbose ; then\r\n echo \"Hello, world!\"\r\n fi\r\n\r\nParse the help and version messages from script comments and pass them as\r\ncommand line arguments::\r\n\r\n #? rock 0.1.0\r\n #? Copyright (C) 200X Thomas Light\r\n #? License RIT (Robot Institute of Technology)\r\n #? This is free software: you are free to change and redistribute it.\r\n #? There is NO WARRANTY, to the extent permitted by law.\r\n \r\n ##? Usage: rock [options] ...\r\n ##?\r\n ##? --help Show help options.\r\n ##? --version Print program version.\r\n \r\n help=$(grep \"^##?\" \"$0\" | cut -c 5-)\r\n version=$(grep \"^#?\" \"$0\" | cut -c 4-)\r\n eval \"$(docopts -h \"$help\" -V \"$version\" : \"$@\")\"\r\n \r\n for arg in \"${argv[@]}\"; do\r\n echo \"$arg\"\r\n done\r\n\r\nUsing the associative array::\r\n\r\n eval \"$(docopts -A args -h \"$help\" : \"$@\")\"\r\n \r\n if ${args[subcommand]} ; then\r\n echo \"subcommand was given\"\r\n fi\r\n \r\n if [ -n \"${args[--long-option-with-argument]}\" ] ; then\r\n echo \"${args[--long-option-with-argument]}\"\r\n else\r\n echo \"--long-option-with-argument was not given\"\r\n fi\r\n \r\n i=0\r\n while [[ $i -lt ${args[,#]} ]] ; do\r\n echo \"${args[,$i]}\"\r\n i=$[$i+1]\r\n done\r\n\r\nVERSIONING\r\n================================================================================\r\nThe ``docopts`` version number always matches that of the\r\n`docopt Python reference implementation `_\r\nversion against which it was built. As ``docopt`` follows\r\n`semantic versioning `_, ``docopts`` should work with any\r\n``docopt`` release it shares the major version number with; however, as both\r\n``docopts`` and ``docopt`` are in major version number 0 at the moment of\r\nwriting this, ``docopts`` can only be relied to work with an installation of\r\n``docopt`` with the exact same version number.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/docopt/docopts", "keywords": "shell bash docopt command-line", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "docopts", "package_url": "https://pypi.org/project/docopts/", "platform": "OS Independent", "project_url": "https://pypi.org/project/docopts/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/docopt/docopts" }, "release_url": "https://pypi.org/project/docopts/0.6.1-fix2/", "requires_dist": null, "requires_python": null, "summary": "Shell interface for docopt, the command-line interface description language.", "version": "0.6.1-fix2" }, "last_serial": 946342, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "4c4c446174de41cdd7fdb9246780bda3", "sha256": "c62e8837982bd2a184c2202c9d456adec7650c313d775b07f5d6400a6fc1cd12" }, "downloads": -1, "filename": "docopts-0.5.0.tar.gz", "has_sig": false, "md5_digest": "4c4c446174de41cdd7fdb9246780bda3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5979, "upload_time": "2012-10-09T20:42:50", "url": "https://files.pythonhosted.org/packages/bc/84/3c4e73335ecafc97a999fc7e81a8d3f6cdcbe36c995ead0f4fd004f61935/docopts-0.5.0.tar.gz" } ], "0.5.0-fix": [ { "comment_text": "", "digests": { "md5": "9588933ef9a0320e02bda50369ebef19", "sha256": "a3b6882db146a8c6d38b98c2a5dd7812357444c09ed01b08cd7d17851ecd2e3e" }, "downloads": -1, "filename": "docopts-0.5.0-fix.tar.gz", "has_sig": false, "md5_digest": "9588933ef9a0320e02bda50369ebef19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5961, "upload_time": "2012-10-16T02:06:12", "url": "https://files.pythonhosted.org/packages/f2/9a/8b6ce6ce01c01a1b70a32699c67a022aad9fafa18f403cc6e20a792fffd3/docopts-0.5.0-fix.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "cb6d62e9a020034902c19b1456618362", "sha256": "9d37a7252ee7b91b1d832e1f3a4af745d055ac148ffbdcc694a0c5f362a4ad8b" }, "downloads": -1, "filename": "docopts-0.6.0.tar.gz", "has_sig": false, "md5_digest": "cb6d62e9a020034902c19b1456618362", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6055, "upload_time": "2013-01-26T20:43:08", "url": "https://files.pythonhosted.org/packages/af/0d/307df55fcedba9bb08aa542ac53b0c8959c5db0d0df32c318e7b411fec4c/docopts-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "58f07caaf57a645fd5fb8c2d7ab18668", "sha256": "ea8d6b03a0931c75a0e4919a0b0856f1c187c38a96174a750c86b41b903a693a" }, "downloads": -1, "filename": "docopts-0.6.1.tar.gz", "has_sig": false, "md5_digest": "58f07caaf57a645fd5fb8c2d7ab18668", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6050, "upload_time": "2013-02-05T00:43:47", "url": "https://files.pythonhosted.org/packages/ba/b3/e96eebbc507ce1db0d90a139ae9af8479a1d8f87da39330a83ab204e842f/docopts-0.6.1.tar.gz" } ], "0.6.1-fix": [ { "comment_text": "", "digests": { "md5": "cc8fa87deaee0027ea9209d2fc1fea40", "sha256": "563aad461c700a60ffb91bc1c5e548ac05399c8f5a62c65ff3b8359717fd3d87" }, "downloads": -1, "filename": "docopts-0.6.1-fix.tar.gz", "has_sig": false, "md5_digest": "cc8fa87deaee0027ea9209d2fc1fea40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5829, "upload_time": "2013-02-06T23:07:57", "url": "https://files.pythonhosted.org/packages/ad/5e/4adbabfffce1baf83e327292ce16b2e2b7e69a22c4ea658df3298271b57c/docopts-0.6.1-fix.tar.gz" } ], "0.6.1-fix2": [ { "comment_text": "", "digests": { "md5": "f3fe69ed7b09c4b87c547a212a861c81", "sha256": "cca74adc7a1c4cb0f8f4274729dea0f60af9464bcdc6cf47c8bb8405c38021f0" }, "downloads": -1, "filename": "docopts-0.6.1-fix2.tar.gz", "has_sig": false, "md5_digest": "f3fe69ed7b09c4b87c547a212a861c81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6020, "upload_time": "2013-05-14T21:16:13", "url": "https://files.pythonhosted.org/packages/60/45/65c0e5f8e9c0ccc08b176bbf808bee6bd1ed96c1465d770a50d3731b67bc/docopts-0.6.1-fix2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f3fe69ed7b09c4b87c547a212a861c81", "sha256": "cca74adc7a1c4cb0f8f4274729dea0f60af9464bcdc6cf47c8bb8405c38021f0" }, "downloads": -1, "filename": "docopts-0.6.1-fix2.tar.gz", "has_sig": false, "md5_digest": "f3fe69ed7b09c4b87c547a212a861c81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6020, "upload_time": "2013-05-14T21:16:13", "url": "https://files.pythonhosted.org/packages/60/45/65c0e5f8e9c0ccc08b176bbf808bee6bd1ed96c1465d770a50d3731b67bc/docopts-0.6.1-fix2.tar.gz" } ] }