{ "info": { "author": "Thomas Maurice", "author_email": "thomas@maurice.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "clifacgtory\n####################\n\nWriting CLI is **NOT** funny. Especially with all the\nargument parsing and shit. This is why this module exists.\n\nInstalling\n==========\n\n.. code:: bash\n\n $ pip install clifactory\n\n.. code:: python\n\n #!/usr/bin/env python\n # -*- coding: utf-8 -*-\n\n from clifactory import CommandLineInterface, Argument\n\n cli = CommandLineInterface()\n users = [\"John Doe\", \"Dick Head\"]\n\n @cli.endpoint(Argument('user', help='username to add'))\n def do_user_add(args):\n users.append(args.user)\n print users\n\n @cli.endpoint()\n def do_user_list(args):\n print users\n\n cli.parse()\n\nAs shown in the ``example.py`` file.\n\nYou can run it like:\n\n.. code:: bash\n\n $ ./exemple.py user add\n usage: exemple.py user add [-h] user\n exemple.py user add: error: too few arguments\n $ ./exemple.py user add \"foo bar\"\n ['John Doe', 'Dick Head', 'foo bar']\n\n\nSimple as that :)\n\nDocumentation\n=============\n\nSome more documentation is comming, stay tuned.\n\nUsing the module\n----------------\n\nYou have to import the components you need, which for now are:\n\n* ``CommandLineInterface``\n* ``Argument``\n* ``ExclusiveGroup``\n\nThen instanciate a ``CommandLineInterface``:\n\n.. code:: python\n\n cli = CommandLineInterface()\n\n\nThen decorate your endpoint as follows:\n\n.. code:: python\n\n @cli.endpoint(\n Argument('argument', help=\"some help\"), # positional arg\n Argument('--user', '-u') # optional argument\n )\n def do_something(args):\n print args # args is a argparse.Namespace object\n\nYou can add as many arguments as you wish, the parameters\nhave to follow the ``argparse.add_argument`` syntax. Note\nthat your function's name must be prefixed with ``do_`` in\norder for the parsing to work. It will just break the\nname of the function into a \"tree\" where each ``_``-delimited\nword will be a leaf. So you can add more methods to your\n'user' endpoint.\n\nFinally to parse something, just call:\n\n.. code:: python\n\n cli.parse()\n\nThis will parse arguments from ``sys.argv``. Alternatively,\nyou may parse an arbitrary string:\n\n.. code:: python\n\n cli.parse(\"some string\")\n\nI told you it does not have to be hard!\n\nLicence\n=======\n\n::\n\n Copyright (C) 2015 Thomas Maurice \n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .", "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/thomas-maurice/clifactory", "keywords": null, "license": "WTFPL", "maintainer": null, "maintainer_email": null, "name": "clifactory", "package_url": "https://pypi.org/project/clifactory/", "platform": "any", "project_url": "https://pypi.org/project/clifactory/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/thomas-maurice/clifactory" }, "release_url": "https://pypi.org/project/clifactory/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Command line made as easy as a web app", "version": "0.1.1" }, "last_serial": 1705936, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "bdb811076d269e98408ffe36652219f4", "sha256": "f55689e034c5be36c74fd33d38c8ee1d3d3a3fb7d936ae4ce056aa35685c85fe" }, "downloads": -1, "filename": "clifactory-0.1.1.tar.gz", "has_sig": false, "md5_digest": "bdb811076d269e98408ffe36652219f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4578, "upload_time": "2015-09-03T06:13:22", "url": "https://files.pythonhosted.org/packages/bd/75/13ea4e04f9e2558112daede53f406cd5b0432a64718ba5f8ba8028a01786/clifactory-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bdb811076d269e98408ffe36652219f4", "sha256": "f55689e034c5be36c74fd33d38c8ee1d3d3a3fb7d936ae4ce056aa35685c85fe" }, "downloads": -1, "filename": "clifactory-0.1.1.tar.gz", "has_sig": false, "md5_digest": "bdb811076d269e98408ffe36652219f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4578, "upload_time": "2015-09-03T06:13:22", "url": "https://files.pythonhosted.org/packages/bd/75/13ea4e04f9e2558112daede53f406cd5b0432a64718ba5f8ba8028a01786/clifactory-0.1.1.tar.gz" } ] }