{ "info": { "author": "Tim Cuthbertson", "author_email": "tim3d.junk+mandy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: http://gfxmonk.net/dist/status/project/mandy.png\r\n\r\n\r\n\"mandy\" is a simple com(mand)-line option parser (see the tenuous name link there?)\r\n\r\nIt uses the standard optparse library, but makes common functionality\r\neasy to write (and read!). Argument type checking is trivial, and you\r\ncan supply your own validation actions to further check\r\napplication-specific logic.\r\n\r\nAn illustrative example::\r\n\r\n\timport mandy\r\n\tclass Main(mandy.Command):\r\n\t\t# you should define `configure` and `run` methods for your\r\n\t\t# command to work\r\n\t\t\r\n\t\tdef configure(self):\r\n\t\t\t# --name (string)\r\n\t\t\tself.opt('name', default='(unnamed)', desc=\"set the name\")\r\n\t\t\t\r\n\t\t\t# -n [1-5], default of 1\r\n\t\t\tself.opt('num-things', int, short='n', long=None, default=1,\r\n\t\t\t action=between_one_and_five, desc=\"num items (1-5)\")\r\n\t\t\t\r\n\t\t\t# --frob or --no-frob\r\n\t\t\tself.opt('frob', bool, default=True, desc=\"use frobbing\")\r\n\t\t\t\r\n\t\t\t# --debug (--no-debug is not added since opposite is False)\r\n\t\t\tself.opt('debug', bool, default=False, opposite=False,\r\n\t\t\t desc=\"Set Debug mode\")\r\n\t\t\t\r\n\t\t\t# --do-thing=yes/no (explicit value)\r\n\t\t\t# (on/off, true/false, yes/no and 1/0 all work for boolean values)\r\n\t\t\tself.opt('do-thing', bool, default=False, explicit=True, desc=\"yes/no\")\r\n\t\t\t\r\n\t\t\t# arg is the same as opt, but without long/short options,\r\n\t\t\t# and optional default values\r\n\t\t\t# this makes:\r\n\t\t\t# command [options] foo1 foo2 [bar] baz\r\n\t\t\tself.arg('foo1')\r\n\t\t\tself.arg('foo2', bool)\r\n\t\t\tself.arg('bar', default=None)\r\n\t\t\tself.arg('baz')\r\n\t\t\r\n\t\tdef run(self, opts):\r\n\t\t\t# opts includes your named options and arguments as attributes\r\n\t\t\tprint \"you set name to %s\" % (opts.name)\r\n\t\t\t\r\n\t\t\t# since you can have options that aren't valid python attributes,\r\n\t\t\t# you can also treat opts as a dict:\r\n\t\t\tprint \"and there are %s things\" % opts['num-things']\r\n\r\n\tdef between_one_and_five(num):\r\n\t\tif not (num >= 1 and num <= 5):\r\n\t\t\traise RuntimeError(\"number must be between one and five\")\r\n\t\t\t\r\n\tif __name__ == '__main__':\r\n\t\tMain()\r\n\r\nthis produces the following when run with --help::\r\n\t\r\n\tUsage: example.py [options] foo1 foo2 [bar] baz\r\n\t\r\n\tOptions:\r\n\t -h, --help show this help message and exit\r\n\t --name=NAME set the name\r\n\t -n N num items (1-5)\r\n\t --frob use frobbing\r\n\t --no-frob \r\n\t --debug Set Debug mode\r\n\t --do-thing=DO_THING yes/no", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/mandy/", "keywords": "optparse option parsing command commandline simple", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "mandy", "package_url": "https://pypi.org/project/mandy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mandy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/mandy/" }, "release_url": "https://pypi.org/project/mandy/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "a terse command-line options parser", "version": "0.1.4" }, "last_serial": 2067236, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1db41eccc2f5feca5b8b6bbe231e018f", "sha256": "2a08c5bcc520fa1ae09615a6688b7e2eda4289dccf3ac4694d8b2e7a8de502cf" }, "downloads": -1, "filename": "mandy-0.1.0-py2.5.egg", "has_sig": false, "md5_digest": "1db41eccc2f5feca5b8b6bbe231e018f", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 20858, "upload_time": "2009-01-03T16:08:59", "url": "https://files.pythonhosted.org/packages/2e/66/4fe80f6f6736c5cf7f0b3e0fab90c090b28816ba1071279c2f661ba936c6/mandy-0.1.0-py2.5.egg" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3dcc36665217f4d8376264297380fe6d", "sha256": "b8c9bf0d54c1e67bbf1ccd37a5f93ab5ef7046929b1043649afb8f081c09588f" }, "downloads": -1, "filename": "mandy-0.1.1-py2.5.egg", "has_sig": false, "md5_digest": "3dcc36665217f4d8376264297380fe6d", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 13231, "upload_time": "2009-01-05T12:18:12", "url": "https://files.pythonhosted.org/packages/69/dd/543256e28ec0d6ad6569f4a1b2e649456db8f18159cc9d7e686645021317/mandy-0.1.1-py2.5.egg" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "542b19628ee8e80e173abfde3fa7545f", "sha256": "2a7184d63196a4db08fb91407513ffb09d84193686e6d95efc36b230edd0f96d" }, "downloads": -1, "filename": "mandy-0.1.2-py2.5.egg", "has_sig": false, "md5_digest": "542b19628ee8e80e173abfde3fa7545f", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 13231, "upload_time": "2009-01-05T12:59:12", "url": "https://files.pythonhosted.org/packages/69/37/85ce5e377d752661b7a72d5d8ad7407651e0e89f59c16c665310ce848d83/mandy-0.1.2-py2.5.egg" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e438f1fe420139d8a4606b8a3d0e05df", "sha256": "cff3db2142c32ba043eae1a69f180a684c5c82a15f71dd84b1fe92c36f9f4fc2" }, "downloads": -1, "filename": "mandy-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e438f1fe420139d8a4606b8a3d0e05df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6763, "upload_time": "2009-06-24T12:23:07", "url": "https://files.pythonhosted.org/packages/69/9a/5608a8e2b8f8902bb2510a4865a7992af94d7435e6a269301700d17640e3/mandy-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "8c728825714e071a9ccfc6b07fa737e5", "sha256": "6297461fb32fc9ac669ab87c29a7c8e5938606db65ba9c613ac76045e02543e2" }, "downloads": -1, "filename": "mandy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "8c728825714e071a9ccfc6b07fa737e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6795, "upload_time": "2009-06-24T13:33:22", "url": "https://files.pythonhosted.org/packages/d3/ed/f9ed4737f6abdde12dc440ba9ee355a3a0f872baecce0ae9bdf310ac4eca/mandy-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8c728825714e071a9ccfc6b07fa737e5", "sha256": "6297461fb32fc9ac669ab87c29a7c8e5938606db65ba9c613ac76045e02543e2" }, "downloads": -1, "filename": "mandy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "8c728825714e071a9ccfc6b07fa737e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6795, "upload_time": "2009-06-24T13:33:22", "url": "https://files.pythonhosted.org/packages/d3/ed/f9ed4737f6abdde12dc440ba9ee355a3a0f872baecce0ae9bdf310ac4eca/mandy-0.1.4.tar.gz" } ] }