{ "info": { "author": "Andrea Capitanelli", "author_email": "andrea@capitanelli.gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "\n# Clips\n\nA simple parser for building graceful command-line interfaces, with chained commands and colorful usage messages. Clips uses [getopt](https://docs.python.org/3/library/getopt.html) for parsing command arguments and options (scanning mode is GNU-flavoured).\n\nColors are implemented through ANSI codes and they are not expected to work on Windows. More generally, please note that Clips is not tested for Windows environment.\n\n# Quick start\n\nInstall with *pip*:\n\n`pip install clips`\n\n# Usage example\n\nA console with a chained command:\n\n```\nfrom clips import ArgParser\n\n# init console\nconsole = ArgParser(\n 'myconsole', # prog. name\n description=description, # prog. description\n banner=banner # usage banner\n)\n\n# add a console-level argument\nconsole.add_argument('-v', '--version', help='Show version')\n\n# add a console command\ncmd = console.add_command('command', help='A command')\n\n# add a subcommand\nsubcmd = cmd.add_command('subcommand', help='A subcommand')\n\n# add an argument to subcommand\nsubcmd.add_argument('arg', help='Argument for this subcommand')\n```\n\nParsing method returns a dictionary of user context,\n\n```\n# parse arguments\nargs = console.parse_args(['command', 'subcommand', 'this'])\nprint(args)\n```\n\nso that output is:\n\n```\n{\n '-h': False,\n '--help': False,\n '-v': False,\n '--version': False,\n 'command': True,\n 'subcommand': True,\n 'arg': 'this'\n}\n```\n\nArgument can have default values:\n\n```\nconsole.add_argument('-o', '--opt', valued=True, default=10)\n```\n\nTo display usage help:\n\n```\n# console-level usage\nprint(console.usage_help())\n\n# command-level usage\nprint(console.usage_help(['command']))\nprint(console.usage_help(['command', 'subcommand']))\n\n```\n\nTo disable internal management of help option:\n\n```\n# init console\nconsole = ArgParser(\n 'myconsole', # prog. name\n add_help=False # no help hook\n)\n```\n\nUse colors for title and text:\n\n```\n# init console\nconsole = ArgParser(\n 'myconsole', # prog. name\n title_fg='orange', # title foreground color\n title_bg='green', # title background color\n text_fg='green', # text foreground color\n text_bg='orange' # text background color\n )\n```\n\nGroup commands by sections (this affects only usage help):\n\n```\n# create section with commands\nconsole.add_section('First section')\ncmd1 = console.add_command('cmd1')\ncmd2 = console.add_command('cmd2')\n\n# another section\nconsole.add_section('Second section')\ncmd3 = console.add_command('cmd3')\ncmd4 = console.add_command('cmd4')\n```\n\nAvailable colors for titles and text parts:\n- foreground: *black*, *red*, *green*, *orange*, *blue*, *cyan*, *lightgrey*, *darkgrey*, *lightred*, *lightgreen*, *yellow*, *lightblue*, *pink*, *lightcyan*\n- background: *black*, *red*, *green*, *orange*, *blue*, *purple*, *cyan*, *lightgrey*\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/acapitanelli/clips", "keywords": "cli parser commands arguments colors", "license": "MIT", "maintainer": "clips", "maintainer_email": "andrea@capitanelli.gmail.com", "name": "clips", "package_url": "https://pypi.org/project/clips/", "platform": "", "project_url": "https://pypi.org/project/clips/", "project_urls": { "Homepage": "https://github.com/acapitanelli/clips" }, "release_url": "https://pypi.org/project/clips/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Parser for command-line applications.", "version": "1.1.0" }, "last_serial": 5857265, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "649e0fa96dc8f7d410b54df8c2c23916", "sha256": "5da29de84fa0fc5961a068b1e47e6138ae9869d5d92a6899070b2f7c8eaccabf" }, "downloads": -1, "filename": "clips-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "649e0fa96dc8f7d410b54df8c2c23916", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6154, "upload_time": "2019-06-29T17:18:44", "url": "https://files.pythonhosted.org/packages/f9/12/0c0f23d4f7360c58d4b77b2ac8f9b97f0251b6ea3f97eb643b441a6fa92b/clips-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc09913517740215ebb37f61d0cfe53b", "sha256": "73bc88d82c4f77b30bd620bcb9a8acd3f69cd47d06d6175a7cbb30690a022788" }, "downloads": -1, "filename": "clips-1.0.0.tar.gz", "has_sig": false, "md5_digest": "bc09913517740215ebb37f61d0cfe53b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5477, "upload_time": "2019-06-29T17:18:46", "url": "https://files.pythonhosted.org/packages/5f/ff/b995a753c68bd2757d5f36538ec744a89313ddb72da9a7094c7775ef8186/clips-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "87271e829b5d344efb6050c09083ff1f", "sha256": "2ded18467f61dda637e523d0b06fe0b42f62a15907553328187ecb8299468a8b" }, "downloads": -1, "filename": "clips-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "87271e829b5d344efb6050c09083ff1f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6469, "upload_time": "2019-09-19T15:46:11", "url": "https://files.pythonhosted.org/packages/0d/4f/16b5d0f60990a9143a9657977411420a9c4f34ca7bc01a5017956e92d9cd/clips-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "67e08049f5b137eb18ee5c3ec2233f67", "sha256": "36298b70103d00d5916b6cced840ec393da0b8b429143fe935b6f21006e21605" }, "downloads": -1, "filename": "clips-1.1.0.tar.gz", "has_sig": false, "md5_digest": "67e08049f5b137eb18ee5c3ec2233f67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5862, "upload_time": "2019-09-19T15:46:13", "url": "https://files.pythonhosted.org/packages/e2/3e/2dc37b51e1f41e637f1432628a80656c203943b5754f5216610503556801/clips-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87271e829b5d344efb6050c09083ff1f", "sha256": "2ded18467f61dda637e523d0b06fe0b42f62a15907553328187ecb8299468a8b" }, "downloads": -1, "filename": "clips-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "87271e829b5d344efb6050c09083ff1f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6469, "upload_time": "2019-09-19T15:46:11", "url": "https://files.pythonhosted.org/packages/0d/4f/16b5d0f60990a9143a9657977411420a9c4f34ca7bc01a5017956e92d9cd/clips-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "67e08049f5b137eb18ee5c3ec2233f67", "sha256": "36298b70103d00d5916b6cced840ec393da0b8b429143fe935b6f21006e21605" }, "downloads": -1, "filename": "clips-1.1.0.tar.gz", "has_sig": false, "md5_digest": "67e08049f5b137eb18ee5c3ec2233f67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5862, "upload_time": "2019-09-19T15:46:13", "url": "https://files.pythonhosted.org/packages/e2/3e/2dc37b51e1f41e637f1432628a80656c203943b5754f5216610503556801/clips-1.1.0.tar.gz" } ] }