{ "info": { "author": "Henri Wiechers", "author_email": "hwiechers@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 7 - Inactive" ], "description": "**NOTE:**\r\n\r\nThis project is abandoned and unsupported.\r\nUse `argparse `_ or `docopt `_ instead.\r\n\r\n--------\r\n\r\n========\r\ncmdstyle\r\n========\r\n\r\ncmdstyle is a library for creating command line interfaces using the command \r\nstyle used by programs like `svn` or `hg`.\r\n\r\nExample\r\n=======\r\n\r\nSample File::\r\n\r\n #! /usr/bin/env python3.2\r\n \r\n import sys\r\n \r\n import cmdstyle\r\n \r\n class HelloCommand(cmdstyle.Command):\r\n 'Print a greeting'\r\n \r\n name = cmdstyle.PosParam()\r\n shout = cmdstyle.Flag(\r\n description='Print the greeting in upper case',\r\n shortname='') \r\n exclamations = cmdstyle.Option(\r\n description='The number of exclamation marks used to end the '\r\n 'greeting',\r\n default=1)\r\n \r\n def __call__(self):\r\n #Note that the library does not do validations\r\n exclamations_int = int(self.exclamations)\r\n \r\n greeting = 'Hello'\r\n if self.name:\r\n greeting += ', ' + self.name\r\n if self.shout:\r\n greeting = greeting.upper()\r\n greeting += exclamations_int * '!'\r\n \r\n print(greeting)\r\n \r\n \r\n class ByeCommand(cmdstyle.Command):\r\n 'Print bye'\r\n \r\n def __call__(self):\r\n print('Bye!')\r\n \r\n \r\n program = cmdstyle.Program(\r\n 'sample.py', \r\n 'Sample Program', \r\n 'Just a sample program', \r\n 'http://...')\r\n \r\n program.register(HelloCommand())\r\n program.register(ByeCommand())\r\n \r\n if __name__ == '__main__':\r\n program.run(sys.argv)\r\n\r\nSample Being Used::\r\n\r\n $ ./sample.py\r\n Use `sample.py help` for usage.\r\n\r\n\r\n $ ./sample.py help\r\n usage: sample.py [options] [args]\r\n \r\n Sample Program\r\n Just a sample program\r\n \r\n Available commands:\r\n bye\r\n hello\r\n \r\n Use `sample.py help ` for help on a specific command.\r\n See http://... for additional information.\r\n\r\n\r\n $ ./sample.py help hello\r\n hello: Print a greeting\r\n usage: hello NAME\r\n Options:\r\n \r\n --shout Print the greeting in upper case\r\n -e --exclamations ARG The number of exclamation marks used to end the greeting\r\n\r\n\r\n $ ./sample.py hello\r\n Hello!\r\n\r\n\r\n $ ./sample.py hello --shout --exclamations 3\r\n HELLO!!!", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypy.python.org/pypi/cmdstyle/", "keywords": "cli", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "cmdstyle", "package_url": "https://pypi.org/project/cmdstyle/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cmdstyle/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypy.python.org/pypi/cmdstyle/" }, "release_url": "https://pypi.org/project/cmdstyle/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Command line interface framework", "version": "0.1.0" }, "last_serial": 787532, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "056d1998a9efff3032ef358b732403c9", "sha256": "67a2ceb2e88a858fa3d19c13c5a42e7976bdf94cb81198bc9c0ee3fdad8433e9" }, "downloads": -1, "filename": "cmdstyle-0.1.0.tar.gz", "has_sig": false, "md5_digest": "056d1998a9efff3032ef358b732403c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10179, "upload_time": "2011-11-09T15:34:47", "url": "https://files.pythonhosted.org/packages/4c/21/4319107b4469283b83b3ebdec2eb1b1e7a9004767368df0574aa7803faff/cmdstyle-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "056d1998a9efff3032ef358b732403c9", "sha256": "67a2ceb2e88a858fa3d19c13c5a42e7976bdf94cb81198bc9c0ee3fdad8433e9" }, "downloads": -1, "filename": "cmdstyle-0.1.0.tar.gz", "has_sig": false, "md5_digest": "056d1998a9efff3032ef358b732403c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10179, "upload_time": "2011-11-09T15:34:47", "url": "https://files.pythonhosted.org/packages/4c/21/4319107b4469283b83b3ebdec2eb1b1e7a9004767368df0574aa7803faff/cmdstyle-0.1.0.tar.gz" } ] }