Skip to content
Myr

Updated the 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 b26d02f · Browse files · 1 file+15 added−2 removed
This commit

State

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

Diff stats

1 file+15 added−2 removed

  • other:+15 added−2 removed

1 file+15 added−2 removed

modified:docs/index.rst+15 added-2 removed
20 unmodified lines
2122 import click2324 @click.command()25 @click.option('--count', default=1, help='number of greetings')25 @click.option('--count', default=1, help='Number of greetings.')26 @click.option('--name', prompt='Your name',27 help='the person to greet', required=True)27 help='The person to greet.')28 def hello(count, name):29 """Simple program that greets NAME for a total of COUNT times."""30 for x in range(count):31 click.echo('Hello %s!' % name)3233 if __name__ == '__main__':34 hello()3536And what it looks like:3738.. click:run::3940 invoke(hello, ['--count=3'], input='John\n')4142And it gives you nicely formatted help pages:4344.. click:run::4546 invoke(hello, ['--help'])4748You can get the library directly from PyPI::4950 pip install click51
34 unmodified lines