{ "info": { "author": "gLhookniano", "author_email": "gLhookniano@protonmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# autoargparse\nMake CMD arg-parser easy and simple.\n\n## dependency\n* python can import argparse\n\n## How to use\n1. pip install autoargparse\n\n2. import autoargparse\n\n3. Initialize : \ncmd = autoargparse.cmd()\n\n4. Use functon decorator :
\n @cmd.args(short_name, long_name, nargs, help, action, type)
\n set function argument as args type\n\n @cmd.kwargs(arg_name=short_name, nargs, help, action, type)
\n set function argument as kwargs type\n\n @cmd.mark(run_order=None)
\n set function run order(integer, bigger first run)\n\n5. Run:\ncmd.run()\n\n## example\n```python\n#!coding:utf-8\n\nimport autoargparse\n\ncmd = autoargparse.cmd('simple calculator for example.')\n\n@cmd.mark(1)\n@cmd.kwargs(ne='--negative', action='store_true')\n@cmd.kwargs(ma='--max', action='store_true')\n@cmd.args('-s', '--sum', '*', type=int)\ndef add(*args, ma, ne):\n if args or ma or ne:\n d = 0\n if ma:\n d = max(args)\n else:\n d = sum(args)\n if ne:\n d = -d\n print(d)\n\n@cmd.mark(2)\n@cmd.args('-v', action='count')\n@cmd.args('-m', '--mul', 2, help='MUL!!!', type=int)\ndef mul(a,b,v=None):\n if not v:\n print(a*b)\n elif v==1:\n print('a * b =', a*b)\n elif v==2:\n print('func =', mul.__name__, 'args =', a, b, v)\n print('a * b =', a*b)\n\n@cmd.mark(3)\n@cmd.args('g', type=int, help='print great')\ndef great(a):\n if a==1:\n print('!!!')\n else:\n print('Great !!!')\n\n\n\nif __name__ == \"__main__\":\n cmd.run()\n```\n\n### OUTPUT\n\n> python .\\example.py -h\n\n```\nusage: test.py [-h] [-s [SUM [SUM ...]]] [--max] [--negative] [-m MUL MUL]\n [-v]\n g\n\nsimple calculator for test.\n\npositional arguments:\n g print great\n\noptional arguments:\n -h, --help show this help message and exit\n -s [SUM [SUM ...]], --sum [SUM [SUM ...]]\n --max\n --negative\n -m MUL MUL, --mul MUL MUL\n MUL!!!\n -v\n```\n\n> python .\\example.py 1\n```\n!!!\n```\n\n> python .\\example.py 2\n```\nGreat !!!\n```\n\n> python .\\example.py 1 -m 2 3\n```\n!!!\n6\n```\n\n> python .\\example.py 1 -m 2 3 -v\n```\n!!!\na * b = 6\n```\n\n> python .\\example.py 1 -m 2 3 -vv\n```\n!!!\nfunc = mul args = 2 3 2\na * b = 6\n```\n\n> python .\\example.py 1 -s 1 2 3 4\n```\n!!!\n10\n```\n\n> python .\\example.py 1 -s 1 2 3 4 --max\n```\n!!!\n4\n```\n\n> python .\\example.py 1 -s 1 2 3 4 --negative\n```\n!!!\n-10\n```\n\n\n## TODO\n* add GUI\n* more easy to use\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/gLhookniano/autoargparse", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "autoargparse", "package_url": "https://pypi.org/project/autoargparse/", "platform": "", "project_url": "https://pypi.org/project/autoargparse/", "project_urls": { "Homepage": "https://github.com/gLhookniano/autoargparse" }, "release_url": "https://pypi.org/project/autoargparse/0.1.0/", "requires_dist": null, "requires_python": ">=3.5.0", "summary": "Make CMD arg-parser easy and simple.", "version": "0.1.0" }, "last_serial": 4442748, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0a4bd2ba37bef3abe308768a0418f427", "sha256": "be3832f51d48b9d9ff32da0baeab5c6b8136974abfd68ffd5117315fabed2fe0" }, "downloads": -1, "filename": "autoargparse-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0a4bd2ba37bef3abe308768a0418f427", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5.0", "size": 9291, "upload_time": "2018-11-01T23:41:39", "url": "https://files.pythonhosted.org/packages/a7/d0/77169aca1c9af273c40da65d7c6951de195771a9571a32e59c805af80415/autoargparse-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90955837d08c748b2458f8a58312ed05", "sha256": "2c872d447f522cc7aa1897527def364439fec583b13d5b74ee8a295ad7944e7e" }, "downloads": -1, "filename": "autoargparse-0.1.0.tar.gz", "has_sig": false, "md5_digest": "90955837d08c748b2458f8a58312ed05", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 6079, "upload_time": "2018-11-01T23:41:41", "url": "https://files.pythonhosted.org/packages/9d/3c/95efdd61bcb899bef52728f798defc7928a7e0426153a19033e1f6931a52/autoargparse-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0a4bd2ba37bef3abe308768a0418f427", "sha256": "be3832f51d48b9d9ff32da0baeab5c6b8136974abfd68ffd5117315fabed2fe0" }, "downloads": -1, "filename": "autoargparse-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0a4bd2ba37bef3abe308768a0418f427", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5.0", "size": 9291, "upload_time": "2018-11-01T23:41:39", "url": "https://files.pythonhosted.org/packages/a7/d0/77169aca1c9af273c40da65d7c6951de195771a9571a32e59c805af80415/autoargparse-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "90955837d08c748b2458f8a58312ed05", "sha256": "2c872d447f522cc7aa1897527def364439fec583b13d5b74ee8a295ad7944e7e" }, "downloads": -1, "filename": "autoargparse-0.1.0.tar.gz", "has_sig": false, "md5_digest": "90955837d08c748b2458f8a58312ed05", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 6079, "upload_time": "2018-11-01T23:41:41", "url": "https://files.pythonhosted.org/packages/9d/3c/95efdd61bcb899bef52728f798defc7928a7e0426153a19033e1f6931a52/autoargparse-0.1.0.tar.gz" } ] }