Command-line argument parsing for Python, without the effort
Project description
Clize procedurally turns your functions into convenient command-line interfaces.
from sigtools.modifiers import kwoargs from clize import run @kwoargs('no_capitalize') def hello_world(name=None, no_capitalize=False): """Greets the world or the given name. name: If specified, only greet this person. no_capitalize: Don't capitalize the given name. """ if name: if not no_capitalize: name = name.title() return 'Hello {0}!'.format(name) return 'Hello world!' if __name__ == '__main__': run(hello_world)
$ pip install clize $ python hello.py --help Usage: hello.py [OPTIONS] name Greets the world or the given name. Positional arguments: name If specified, only greet this person. Options: --no-capitalize Don't capitalize the given name. Other actions: -h, --help Show the help $ python hello.py Hello world! $ python hello.py john Hello John! $ python hello.py --no-capitalize Hello john!
You can find the documentation at: http://clize.readthedocs.org/en/latest/
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
clize-3.0a2.tar.gz
(21.3 kB
view hashes)
Built Distribution
clize-3.0a2-py2.py3-none-any.whl
(24.0 kB
view hashes)
Close
Hashes for clize-3.0a2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ad2cfbaadabc6056ab951ef73e1f9d5f8a5e4f746ae11e285badfdd0f474639 |
|
MD5 | a4254e0f53d6f24781b44a4e4ccf4657 |
|
BLAKE2b-256 | 830c8258f78421663fd5c12cc1041b9b0e2466098886f79a0709a45203223cfd |