A simple wrapper around optparse for powerful command line utilities.
Project description
What’s Click?
Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with sensible defaults out of the box.
It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.
- Click in three points:
arbitrary nesting of commands
automatic help page generation
supports lazy loading of subcommands at runtime
Installing
Install and update using pip:
$ pip install click
Click supports Python 3.4 and newer, Python 2.7, and PyPy
A Simple Example
What does it look like? Here is an example of a simple Click program:
import click
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name',
help='The person to greet.')
def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo('Hello %s!' % name)
if __name__ == '__main__':
hello()
And what it looks like when run:
$ python hello.py --count=3
Your name: John
Hello John!
Hello John!
Hello John!
Donate
The Pallets organization develops and supports Flask and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.
Links
Documentation: http://click.pocoo.org/
License: BSD
Releases: https://pypi.org/project/click/
Issue tracker: https://github.com/pallets/click/issues
Test status:
Linux, Mac: https://travis-ci.org/pallets/click
Test coverage: https://codecov.io/gh/pallets/click
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
Built Distribution
File details
Details for the file click--hotoffthehamster-7.0.dev1.tar.gz
.
File metadata
- Download URL: click--hotoffthehamster-7.0.dev1.tar.gz
- Upload date:
- Size: 290.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c405b9967c2fc07087c59b4f6d0e71f545401e45ab126b4e5cd3b62a75c5b0c9 |
|
MD5 | 4b97f3aa6f0752d4fdad44f2e74a522a |
|
BLAKE2b-256 | f8d4235d5fa5d1329c1272443cae1712fb337cb5acf6ad7f6677cfea609b8227 |
File details
Details for the file click_hotoffthehamster-7.0.dev1-py2.py3-none-any.whl
.
File metadata
- Download URL: click_hotoffthehamster-7.0.dev1-py2.py3-none-any.whl
- Upload date:
- Size: 78.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 408a7c637009d7283d60cab4e63ebbe0dd10d05cb4d1141a49e7d7a6284456d9 |
|
MD5 | 6450222a9490f00fa3601a592bacb5de |
|
BLAKE2b-256 | 01a9ad334b93ba23c219d6523134cd4e66cd818b051b9b25a03d0ef6c3ce87b7 |