specify command arguments in function decorator
Project description
argdeco
=======
Specify command line arguments using decorators::
from argdeco import main, arg, opt
@main(
arg("--foo", help="some argument"),
opt("--flag", '-f', help="toggle flag"),
)
def my_main_function(foo, flag):
return 0 # success, will be exit code
if __name__ == '__main__':
main()
argdeco is an argparse wrapper.
* ``arg()`` is only a wrapper around ``argparse.ArgumentParser.add_argument()``.
* ``opt()`` is a shorthand for ``arg(..., action=store_true, default=False)``
... you can do `much more`_
.. [much more] https://python-argdeco.readthedocs.io
=======
Specify command line arguments using decorators::
from argdeco import main, arg, opt
@main(
arg("--foo", help="some argument"),
opt("--flag", '-f', help="toggle flag"),
)
def my_main_function(foo, flag):
return 0 # success, will be exit code
if __name__ == '__main__':
main()
argdeco is an argparse wrapper.
* ``arg()`` is only a wrapper around ``argparse.ArgumentParser.add_argument()``.
* ``opt()`` is a shorthand for ``arg(..., action=store_true, default=False)``
... you can do `much more`_
.. [much more] https://python-argdeco.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
argdeco-2.1.0.tar.gz
(15.9 kB
view details)
File details
Details for the file argdeco-2.1.0.tar.gz
.
File metadata
- Download URL: argdeco-2.1.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98e5d9dc4df7324cb18062d87d34c15d0d264f90719a273d88cb576cc323a831 |
|
MD5 | 4b89a1955c4f747fd18344d1136dd6ae |
|
BLAKE2b-256 | 03ecf9f8e0832f77a2d6ee3f17bf52ed69ae5080b6d605c322e3a4e7223bd56a |