{ "info": { "author": "Heitor Polidoro", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Argument [![Latest](https://img.shields.io/github/release/heitorpolidoro/argument.svg?label=latest)](https://github.com/heitorpolidoro/argument/releases/latest)\nPackage to create command line arguments for Python.\n\n#### How to use:\n\n- Decorate the method you want to create an argument from with `@Argument`.\n- Decorate the method you want to call from command line with `@Command`.\n- Create a `ArgumentParser` (from this package not from argparse)\n- Call `parser.parse_args()`\n\nAll keywords arguments to `@Argument` are the same as in [argparse.ArgumentParser.add_argument](https://docs.python.org/3.7/library/argparse.html#the-add-argument-method) except for 'action' and 'nargs'.\n'action' is a custom Action created to run the decorated method and 'nargs' is the number of parameters in the decorated method. \n\nAll keywords arguments are the same as in [argparse.ArgumentParser.add_argument](https://docs.python.org/3.7/library/argparse.html#the-add-argument-method) except for 'action' and 'nargs'.\n'action' is a custom Action created to run the decorated method and 'nargs' is the number of parameters in the decorated method. \n###### Exemples:\nfoo.py\n```\n\nfrom argument import Argument, ArgumentParser\n\n@Argument\ndef bar():\n print('hi')\n\nparser = ArgumentParser()\nparser.parse_args()\n```\nResult:\n```\n$ python foo.py --bar\nhi \n```\n\nYou can pass argument to the method\n```\n@Argument\ndef bar(baz=None):\n print(baz)\n```\n```\n$ python foo.py --bar Hello\nHello\n```\nTo create commands\n```\n@Command\ndef command():\n print('this is a command')\n```\n```\n$ python foo.py command\nthis is a command\n```\nWith arguments\n```\n@Command\ndef command_with_arg(arg, arg1=None):\n print('this the command arg: %s, arg1: %s' % (arg, arg1))\n```\n```\n$ python foo.py command_with_arg Hello\nthis the command arg: Hello, arg1: None\n$ python foo.py command_with_arg Hello --arg1 World\nthis the command arg: Hello, arg1: World\n```\nUsing a Class\n```\nclass ClassCommand(object):\n @staticmethod\n @Argument\n def argument_in_class():\n print('argument_in_class')\n\n @staticmethod\n @Command\n def command_in_class(arg=None):\n print('command_in_class. arg %s' % arg)\n```\n```\n$ python foo.py classcommand --argument_in_class\nargument_in_class\n$ python foo.py classcommand command_in_class\nargument_in_class. arg None\n$ python foo.py classcommand command_in_class Ola\nargument_in_class. arg Ola\n```\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/heitorpolidoro/argument", "keywords": "", "license": "unlicense", "maintainer": "", "maintainer_email": "", "name": "polidoro-py-argument", "package_url": "https://pypi.org/project/polidoro-py-argument/", "platform": "", "project_url": "https://pypi.org/project/polidoro-py-argument/", "project_urls": { "Homepage": "https://github.com/heitorpolidoro/argument" }, "release_url": "https://pypi.org/project/polidoro-py-argument/1.1.1/", "requires_dist": null, "requires_python": "", "summary": "Package to create command line arguments for Python.", "version": "1.1.1" }, "last_serial": 5896178, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c8acad202ed3969756a4a10db2e44b49", "sha256": "8ba91d261a0bafe35d000920e9f6127c67edf2787f75da29752f49fd767fe8b9" }, "downloads": -1, "filename": "polidoro_py_argument-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c8acad202ed3969756a4a10db2e44b49", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4195, "upload_time": "2019-09-17T19:37:38", "url": "https://files.pythonhosted.org/packages/5d/a6/74122ee1c2a8b35af7ed972f0b486978d1d656890370d1effff003c3c53e/polidoro_py_argument-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3abce29069c1f1a28209746e108ead73", "sha256": "d2cf4953b24c61ebab3865154bbefe7a84c131b3339d67e760e83e61cb397fad" }, "downloads": -1, "filename": "polidoro-py-argument-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3abce29069c1f1a28209746e108ead73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2334, "upload_time": "2019-09-17T19:37:40", "url": "https://files.pythonhosted.org/packages/12/9b/f974453b89bbcc60487f7ee2f3296e9ed9d2f839e3b57f652307987dfb3d/polidoro-py-argument-0.1.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "778bfce0f13dd219970908087fbfbea2", "sha256": "3ebb9625bc3137449453b7e6ccea4200499a38758611298d1fa2b2f5719be77f" }, "downloads": -1, "filename": "polidoro_py_argument-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "778bfce0f13dd219970908087fbfbea2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5827, "upload_time": "2019-09-24T19:15:53", "url": "https://files.pythonhosted.org/packages/a6/f5/ddf4ebf84472ab728f6113443c4adc5fbc6a9da41772e8781f780969db0c/polidoro_py_argument-1.1.0-py3-none-any.whl" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "f2746bf95c49ea770fb439388e50a72e", "sha256": "a5fd2cea7dadf218ba3ee006c0f6133bc50dc4c28dafbf7a170377e3680b1b88" }, "downloads": -1, "filename": "polidoro_py_argument-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f2746bf95c49ea770fb439388e50a72e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6077, "upload_time": "2019-09-27T13:40:44", "url": "https://files.pythonhosted.org/packages/4d/46/1c8bbf7a502245d74c3674e27abdc930bdfc40112ff217a309533c6185b0/polidoro_py_argument-1.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f2746bf95c49ea770fb439388e50a72e", "sha256": "a5fd2cea7dadf218ba3ee006c0f6133bc50dc4c28dafbf7a170377e3680b1b88" }, "downloads": -1, "filename": "polidoro_py_argument-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f2746bf95c49ea770fb439388e50a72e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6077, "upload_time": "2019-09-27T13:40:44", "url": "https://files.pythonhosted.org/packages/4d/46/1c8bbf7a502245d74c3674e27abdc930bdfc40112ff217a309533c6185b0/polidoro_py_argument-1.1.1-py3-none-any.whl" } ] }