{ "info": { "author": "takumakanari (chemtrails.t@gmail.com)", "author_email": "chemtrails.t@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "climson\n==========\n\nclimson is a tool for easy and simplify to implement applications that is using multi-command CLI.\n\nclimsonize your application\n-----------\n\nLet me show you climson with an example. \n\nThere are **Only 4 steps to implementation.**\n\n#. Create handler-class extends *climson.BaseCommand*.\n#. Specify *name(required)* as sub-command name and *description* into class field.\n#. Implement *do_command(self, **kwargs)* method. If command executes with somw options, method takes it as **kwargs.\n#. Make client instance & register command classes.\n\nCreate *handler-class* for each sub commands ::\n\n # file: my_command.py\n\n from climson import climsonClient\n from climson import climson\n from climson.climson import make_option\n\n class Hello(climson.BaseCommand):\n \n # command name (required)\n name = 'hello'\n\n # sub command description\n description = 'Say hello!'\n\n def do_command(self):\n print 'Hello!'\n\nIf you want to use some options, specify it to field *options* like this.\n\nIt means same as *argparse.add_argument()*, and it's 2 ways to reference opt's values in do_command(), **kwargs with do_command method or self.optargs.\n\n::\n\n options = climson.BaseCommand.options + (\n make_option('-n', '--name', help='Your name', required=True, dest='name'),\n make_option('-a', '--age', help='Your age', required=False, type=int, dest='age'), \n )\n\n::\n\n class Goodbye(climson.BaseCommand):\n\n name = 'goodbye'\n\n description = 'Say goodbye!'\n\n options = climson.BaseCommand.options + (\n make_option('-n', '--name', help='Your name', required=True, dest='name'),\n make_option('-a', '--age', help='Your age', required=False, type=int, dest='age'), \n )\n\n #\n # commandline-option's name/value as **kwargs\n #\n def do_command(self, message=None, age=0):\n print 'Goodbye, {}(age:{}) in kwargs'.format(message, age)\n\n # Or can reference original args object with self.optargs\n print 'Goodbye, {}(age:{}) in optargs'.format(self.optargs.message, self.optargs.are)\n\n #\n # Do Custom validate if you need.\n #\n def validate(self, message=None, age=0):\n if age < 0:\n raise ValidateError('Specify age!')\n return True\n\n.. note::\n If you want to validate option values, override method *validate(self, **kwargs)*. It returns bool as check result or raise climson.climson.ValidateError when validate failed.\n\n\n\nRegister commands and kick it.\n\n*climson.climsonClient.__init__* arguments link to *argparse.ArgumentParser()*'s it.\n\n::\n\n if __name__ == '__main__':\n from climson import climsonClient\n message_client = climsonClient(description='Show some messages!', prog='Myprog')\n message_client.add(Hello)\n message_client.add(GoodBye)\n message_client.execute()\n\nSo you can execute application with command.\n\n::\n\n $ python my_command.py --help\n $ python my_command.py hello --help\n $ python my_command.py hello\n $ python my_command.py goodbye --name Michel --age 20\n\n\nCommandfy decorator\n-----------\ncommandfy-decorator to simplify further these implementation of climsonize.\nYou can execute commands only prepare method of each commands.\n\n::\n\n from climson import commandfy\n from climson import commandfy_client\n\n @commandfy(description='Say hello!')\n def hello():\n print 'Hello!'\n\n @commandfy(description='Say goodbye!')\n def goodbye(name=None, age=0):\n print 'Goodbye, {}(age:{})'.format(message, age)\n\n if __name__ == '__main__':\n commandfy_client.execute()\n\n.. note::\n * If you want to validate options, you have to implement that yourself.\n * Can not specify commandline opt type, short name, actions etc..\n * But commandfy is so simple!\n\nInstallation \n-----------\n\nclimson is hosted on two different platforms, PyPI_ and GitHub_.\n\n#. **Install from PyPI**\n\n Install climson from PyPI_ for a stable version ::\n\n $ sudo pip install climson\n\n#. **Get Clime from GitHub**\n\n If you want to follow the latest version of climson, use ::\n\n $ git clone git://github.com/takumakanari/climson.git\n \n to clone a repository, or download manually from GitHub_.\n\n\n.. _GitHub:\n http://github.com/takumakanari/climson\n\n.. _PyPI:\n http://pypi.python.org/pypi/climson", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "unix,linux,commandline,cli,command,climson", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "climson", "package_url": "https://pypi.org/project/climson/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/climson/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/climson/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "Commandline tool for easy and simplify to implement applications that is using multi-command CLI.", "version": "0.1.3" }, "last_serial": 875829, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "562468153bc2344c3d2a0a1a540ffdf3", "sha256": "9421388d34b0b2eba9b6fc7e9cd9189548c1a508b0de980facd54c8c3a030c75" }, "downloads": -1, "filename": "climson-0.1.2.tar.gz", "has_sig": false, "md5_digest": "562468153bc2344c3d2a0a1a540ffdf3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6402, "upload_time": "2013-09-22T09:47:19", "url": "https://files.pythonhosted.org/packages/c2/34/1f6cc249ec6f33e163b390cad38306b8f7bd19d6a5d586a874409a33278c/climson-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "5a738e31670dd47b4e7a41c596c99526", "sha256": "4847eee8373aee5ebc27f825e40be05f3b6e6a4038c2345ac027776658592710" }, "downloads": -1, "filename": "climson-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5a738e31670dd47b4e7a41c596c99526", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6366, "upload_time": "2013-09-28T05:18:19", "url": "https://files.pythonhosted.org/packages/90/5e/85099be1911d88ec17515f7cd5a9d326c24e2d6a051780cf8585f0c43e6c/climson-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a738e31670dd47b4e7a41c596c99526", "sha256": "4847eee8373aee5ebc27f825e40be05f3b6e6a4038c2345ac027776658592710" }, "downloads": -1, "filename": "climson-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5a738e31670dd47b4e7a41c596c99526", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6366, "upload_time": "2013-09-28T05:18:19", "url": "https://files.pythonhosted.org/packages/90/5e/85099be1911d88ec17515f7cd5a9d326c24e2d6a051780cf8585f0c43e6c/climson-0.1.3.tar.gz" } ] }