{ "info": { "author": "Bertalan Pecsi", "author_email": "zellerede@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# simple-cli-args\nA python main method decorator.
\nAn enhancement of the `argparse` package for its simplest usages.
\n**Requires python 3.6 or higher.**\n\nThe ordinary arguments become positional, the arguments with default value become named argument for the CLI, \nwith a possibility of abbreviations, as `argparse` provides it.
\nHelp option (`-h` or `--help`) is automatically generated with its text taken from the docstrings.\n\n### Install\n\n#### Using pip\n pip install simple_cli_args\n\nor, with your intended python command in place of `python3`\n\n python3 -m pip install simple_cli_args\n\n#### Using setuptools\nSimply issue in the main directory of the cloned git repository:\n\n ./setup.py install\n\n### Usage\nAssume the content of *my_cli.py* is:\n\n #!/usr/bin/env python3\n from simple_cli_args import cli_args\n\n @cli_args\n def main(apple, banana, cucumber='green'):\n print(\"Our fruits are:\", apple, banana, cucumber)\n\n if __name__ == '__main__':\n main() # without arguments given, those will be read from the CLI\n\nThen, we get the following printouts:\n\n $ ./my_cli.py red yellow\n Our fruits are: red yellow green\n\n $ ./my_cli.py red yellow --cucumber=purple\n Our fruits are: red yellow purple\n\n $ ./my_cli.py red yellow -c nice\n Our fruits are: red yellow nice\n\n $ ./my_cli.py red\n usage: my_cli.py [-h] [--cucumber | -c CUCUMBER] apple banana\n my_cli.py: error: the following arguments are required: banana\n\n $ ./my_cli.py --help\n usage: my_cli.py [-h] [--cucumber | -c CUCUMBER] apple banana\n\n positional arguments:\n apple\n banana\n\n optional arguments:\n -h, --help show this help message and exit\n --cucumber | -c CUCUMBER\n default: green\n\n#### Decorate a main class\n\nIf main functionality is built into a class, the decorator can be used for its contructor `__init__` method, as well as for the class itself, like in the example below.\n\n #!/usr/bin/env python3\n from simple_cli_args import cli_args\n\n @cli_args\n class Main:\n def __init__(self, apple, banana, cucumber='green'):\n self.fruits = apple, banana, cucumber\n def show(self):\n print(\"Our fruits are:\", *self.fruits)\n\n if __name__ == '__main__':\n main = Main() # without arguments given, those will be read from the CLI\n main.show()\n\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/zellerede/simple-cli-args", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "simple-cli-args", "package_url": "https://pypi.org/project/simple-cli-args/", "platform": "", "project_url": "https://pypi.org/project/simple-cli-args/", "project_urls": { "Homepage": "https://github.com/zellerede/simple-cli-args" }, "release_url": "https://pypi.org/project/simple-cli-args/0.20/", "requires_dist": null, "requires_python": "", "summary": "An enhancement of argparse package for its simplest usages", "version": "0.20" }, "last_serial": 5343675, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "175ee67072f90047de389c6183ed4377", "sha256": "da6f12b6075e71e739ae66a0ac9b6ff39365390f091617dd6e49a5d96f559f8b" }, "downloads": -1, "filename": "simple_cli_args-0.1-py3.5.egg", "has_sig": false, "md5_digest": "175ee67072f90047de389c6183ed4377", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 2785, "upload_time": "2019-04-27T21:50:41", "url": "https://files.pythonhosted.org/packages/47/9b/95e07a7dcd748598185742a6d965d247e9b9cbfaf20d20f4f4b1eee5d431/simple_cli_args-0.1-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "23bb7103f4def77eb0e7d336c9cc1027", "sha256": "5023c40a1ce06890be7e69b89988fe57b4831ffe5af83529c4d86ba7aac6e30a" }, "downloads": -1, "filename": "simple_cli_args-0.1-py3.7.egg", "has_sig": false, "md5_digest": "23bb7103f4def77eb0e7d336c9cc1027", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 5229, "upload_time": "2019-04-27T21:50:43", "url": "https://files.pythonhosted.org/packages/0d/52/15366464f0106d251a9bed5cba83bc9bd9162adc0febf6059cdbc07202ba/simple_cli_args-0.1-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "bd75a1f68f457fff34b4134ae96cb079", "sha256": "f88522f017d1915c23ed10ffb1fe40c6648e23f59f0010f667eb311367dbf84d" }, "downloads": -1, "filename": "simple_cli_args-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bd75a1f68f457fff34b4134ae96cb079", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4193, "upload_time": "2019-04-27T21:50:31", "url": "https://files.pythonhosted.org/packages/58/68/0ee470a91e11b8e03692168f45b834adecbb0e55bdbffeb14dce50d7395d/simple_cli_args-0.1-py3-none-any.whl" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "7901b275ff391113b3d06212e49d5196", "sha256": "4664f287ece81a40f505b8a8052d20164f292d245f67df64692316ca78f9745d" }, "downloads": -1, "filename": "simple_cli_args-0.12-py3-none-any.whl", "has_sig": false, "md5_digest": "7901b275ff391113b3d06212e49d5196", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4349, "upload_time": "2019-05-07T23:45:50", "url": "https://files.pythonhosted.org/packages/51/8f/a000d6082e6ae8ba6109923951328b7079b78273c8aa6ea86937909321d0/simple_cli_args-0.12-py3-none-any.whl" } ], "0.20": [ { "comment_text": "", "digests": { "md5": "3407ccb36fca2ba671ff60cac20e9bdf", "sha256": "6fdd107337bed5ea313c1001df3225edf54692de19e40d70206532cfdd33b436" }, "downloads": -1, "filename": "simple_cli_args-0.20-py3-none-any.whl", "has_sig": false, "md5_digest": "3407ccb36fca2ba671ff60cac20e9bdf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4442, "upload_time": "2019-05-31T17:03:27", "url": "https://files.pythonhosted.org/packages/d4/e3/0a1ac16aaa3134d001f9799bf58db6b4fd73b68abe0844e7add2ca54ae0c/simple_cli_args-0.20-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd38fc3f70ce098ab448572194979973", "sha256": "c8aa833b7bf31b9ceeda723dedfeea1403648866a57141266f8ca279fba3f49d" }, "downloads": -1, "filename": "simple_cli_args-0.20.tar.gz", "has_sig": false, "md5_digest": "fd38fc3f70ce098ab448572194979973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4321, "upload_time": "2019-05-31T17:03:28", "url": "https://files.pythonhosted.org/packages/4b/ea/b2fde579a0899c108ad11c3ffc7348104657ad8f89ba209c42e09245842c/simple_cli_args-0.20.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3407ccb36fca2ba671ff60cac20e9bdf", "sha256": "6fdd107337bed5ea313c1001df3225edf54692de19e40d70206532cfdd33b436" }, "downloads": -1, "filename": "simple_cli_args-0.20-py3-none-any.whl", "has_sig": false, "md5_digest": "3407ccb36fca2ba671ff60cac20e9bdf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4442, "upload_time": "2019-05-31T17:03:27", "url": "https://files.pythonhosted.org/packages/d4/e3/0a1ac16aaa3134d001f9799bf58db6b4fd73b68abe0844e7add2ca54ae0c/simple_cli_args-0.20-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd38fc3f70ce098ab448572194979973", "sha256": "c8aa833b7bf31b9ceeda723dedfeea1403648866a57141266f8ca279fba3f49d" }, "downloads": -1, "filename": "simple_cli_args-0.20.tar.gz", "has_sig": false, "md5_digest": "fd38fc3f70ce098ab448572194979973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4321, "upload_time": "2019-05-31T17:03:28", "url": "https://files.pythonhosted.org/packages/4b/ea/b2fde579a0899c108ad11c3ffc7348104657ad8f89ba209c42e09245842c/simple_cli_args-0.20.tar.gz" } ] }