Skip to content
Myr

Added a colorama example.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent f46b3f9 · Browse files · 4 files+41 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+41 added−0 removed

  • other:+41 added−0 removed

4 files+41 added−0 removed

modified:docs/quickstart.rst+2 added
30 unmodified lines
31* ``complex``: `Complex example with plugin loading32 <https://github.com/mitsuhiko/click/tree/master/examples/complex>`_33* ``validation``: `Custom parameter validation example34 <https://github.com/mitsuhiko/click/tree/master/examples/validation>`_35* ``colors``: `Colorama ANSI color support36 <https://github.com/mitsuhiko/click/tree/master/examples/colors>`_3738Basic Concepts39--------------40
117 unmodified lines
added:examples/colors/colors.py+14 added
1import click2from colorama import Fore345@click.command()6def cli():7 """This script prints some colors through colorama. This will give8 colors on OS X, Linux and Windows but it will automatically disable9 those colors if stdout is redirected to a file.1011 Give it a try!12 """13 click.echo(Fore.YELLOW + 'Hello World!' + Fore.RESET)14 click.echo(Fore.RED + 'Goodbye World!' + Fore.RESET)
added:examples/colors/README+9 added
1$ colors_23 colors is a simple example that shows how you can4 colorize text with the built-in colorama integration.56Usage:78 $ pip install --editable .9 $ colors
added:examples/colors/setup.py+16 added
1from setuptools import setup23setup(4 name='click-example-colors',5 version='1.0',6 py_modules=['colors'],7 include_package_data=True,8 install_requires=[9 'Click',10 'colorama',11 ],12 entry_points='''13 [console_scripts]14 colors=colors:cli15 ''',16)