{ "info": { "author": "Joseph Paul", "author_email": "joseph@sehrgute.software", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Python CLI App\n> Framework for creating CLI apps using Python\n\nThe purpose of this library is to speed up bulding CLI applications by providing abstract classes representing an app and its commands. It uses `argparse` to define and parse command line arguments.\n\n## Concepts\n### App\nAn \"App\" is the main entry point of an application. It groups together one or more commands\n\n### Command\nA \"Command\" is a single operation that the application can perform. It is identified by a positional argument on the command line. Let's take `git` as an example. `git` would be the **app** that provides different **commands**, such as `add`, `commit`, `merge`, `checkout`, etc.\n\n## Example\n**git.py**\n```python\n#!/usr/bin/env python3\n\nfrom cli_app import App\nfrom commands.checkout import Checkout\nfrom commands.merge import Merge\n\n\nclass Git(App):\n \"\"\"Git - fast, scalable, distributed revision control system\"\"\"\n\n def register_commands(self):\n self.add_command('checkout', Checkout) # make the Checkout command available through `git.py checkout \u2026`\n self.add_command('merge', Merge) # make the Merge command available through `git.py merge \u2026`\n\n\nif __name__ == '__main__':\n app = Git()\n app.run()\n\n```\n\n**commands/checkout.py**\n```python\nfrom cli_app import Command\n\n\nclass Checkout(Command):\n \"\"\"Switch branches or restore working tree files\"\"\"\n\n @staticmethod\n def register_arguments(parser):\n parser.add_argument('ref', type=str, help='The ref (branch name, tag, commit sha) to checkout')\n\n def run(self):\n # Do whatever needs to be done to checkout given ref\n print('Checking out %s' % self.app.args.ref)\n```\n\n**commands/merge.py**\n```python\nfrom cli_app import Command\n\n\nclass Merge(Command):\n \"\"\"Join two or more development histories together\"\"\"\n\n @staticmethod\n def register_arguments(parser):\n parser.add_argument('branch', type=str, help='The branch to merge into the currently checked-out branch')\n\n def run(self):\n # Do whatever needs to be done to merge given branch\n print('Merging %s into current branch' % self.app.args.branch)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jsphpl/python-cli-app", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "cli-app", "package_url": "https://pypi.org/project/cli-app/", "platform": "", "project_url": "https://pypi.org/project/cli-app/", "project_urls": { "Homepage": "https://github.com/jsphpl/python-cli-app" }, "release_url": "https://pypi.org/project/cli-app/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Framework for creating CLI apps using Python", "version": "0.1.0" }, "last_serial": 5288404, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "301944fb0904255738b5ab06700b7ea4", "sha256": "652d829e6cfa44a776d9442f142178406741f3cec7e9fa597b1fe954873ed495" }, "downloads": -1, "filename": "cli_app-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "301944fb0904255738b5ab06700b7ea4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5787, "upload_time": "2019-05-19T14:08:25", "url": "https://files.pythonhosted.org/packages/02/f9/7cc1737a26d9133e5dd3f94945a5e685cca9735aa93c56c216d0c3865851/cli_app-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fd6d298c21cfc542aa4452da265a71d", "sha256": "826e541f3aa3243ba2d134d20435ace714912166b34f74bfe64852e55a49d90d" }, "downloads": -1, "filename": "cli-app-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6fd6d298c21cfc542aa4452da265a71d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3507, "upload_time": "2019-05-19T14:08:27", "url": "https://files.pythonhosted.org/packages/74/ae/e7a944793bd87ff96e0f488419fe780848f83fea4134329b0893a2ac50e7/cli-app-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "301944fb0904255738b5ab06700b7ea4", "sha256": "652d829e6cfa44a776d9442f142178406741f3cec7e9fa597b1fe954873ed495" }, "downloads": -1, "filename": "cli_app-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "301944fb0904255738b5ab06700b7ea4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5787, "upload_time": "2019-05-19T14:08:25", "url": "https://files.pythonhosted.org/packages/02/f9/7cc1737a26d9133e5dd3f94945a5e685cca9735aa93c56c216d0c3865851/cli_app-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fd6d298c21cfc542aa4452da265a71d", "sha256": "826e541f3aa3243ba2d134d20435ace714912166b34f74bfe64852e55a49d90d" }, "downloads": -1, "filename": "cli-app-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6fd6d298c21cfc542aa4452da265a71d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3507, "upload_time": "2019-05-19T14:08:27", "url": "https://files.pythonhosted.org/packages/74/ae/e7a944793bd87ff96e0f488419fe780848f83fea4134329b0893a2ac50e7/cli-app-0.1.0.tar.gz" } ] }