Make composable Python command line applications.
See official documentation: http://click.pocoo.org/latest/
An example with a command and a couple options:
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()
- Hello, World: hello.py
- Options: options.py
- Basic values
- Choices
- Boolean
- Feature switches
- More on options
- Arguments: arguments.py
- Variadic arguments
- More on arguments
- Commands: commands.py
- Sub-commands
- More on commands
- Utilities: utilities.py:
- Colors
- Progress bars
- Screen clearing
- More on utilities