simple argument parser like as python-fire
Project description
a simple tiny wrapper of argument parser
There are already pairs of optional keywords and default values and types in function signature, and docstring as a description. just use it!
no more verbose code for command line options :)
write sample.py
# sample.py
def main(pos1, pos2, kw1=1, kw2=2):
"""
dostring as a help string
:param pos1:
:param pos2:
:param kw1:
:param kw2:
:return:
"""
pass
if __name__ == '__main__':
import autoarg
autoarg.run(main)
just run
$ python sample.py -h
$ python sample.py --help
usage: sample.py [-h] [--kw2 KW2] [--kw1 KW1] pos1 pos2
dostring as a help string
:param pos1:
:param pos2:
:param kw1:
:param kw2:
:return:
positional arguments:
pos1
pos2
optional arguments:
-h, --help show this help message and exit
--kw2 KW2 kw2 : default = 2
--kw1 KW1 kw1 : default = 1
if you need complex one, consider python-fire
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autoarg-0.0.4.2.tar.gz
(3.7 kB
view details)
File details
Details for the file autoarg-0.0.4.2.tar.gz
.
File metadata
- Download URL: autoarg-0.0.4.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e723f002bade423d536d8f6043f97398de70f405b94a74668a672386762c7bb |
|
MD5 | 55fec79b57483b26ec4558dc9a496389 |
|
BLAKE2b-256 | 5299820b731110b4587d88ad8acba7ca9ecff8969f8ea204505f7eeceedc4025 |