index.rst
This file
Path
docs/index.rst
107 lines · 2.2 KiB
Last changed by
Merge pull request #1100 from pallets/sphinxDavid Lordbefore adoptionb1b8c48
History of this fileTake it
1.. rst-class:: hide-header23Welcome to Click4================56.. image:: _static/click-logo.png7 :align: center8 :scale: 50%9 :target: https://palletsprojects.com/p/click/1011Click is a Python package for creating beautiful command line interfaces12in a composable way with as little code as necessary. It's the "Command13Line Interface Creation Kit". It's highly configurable but comes with14sensible defaults out of the box.1516It aims to make the process of writing command line tools quick and fun17while also preventing any frustration caused by the inability to implement18an intended CLI API.1920Click in three points:2122- arbitrary nesting of commands23- automatic help page generation24- supports lazy loading of subcommands at runtime2526What does it look like? Here is an example of a simple Click program:2728.. click:example::2930 import click3132 @click.command()33 @click.option('--count', default=1, help='Number of greetings.')34 @click.option('--name', prompt='Your name',35 help='The person to greet.')36 def hello(count, name):37 """Simple program that greets NAME for a total of COUNT times."""38 for x in range(count):39 click.echo('Hello %s!' % name)4041 if __name__ == '__main__':42 hello()4344And what it looks like when run:4546.. click:run::4748 invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')4950It automatically generates nicely formatted help pages:5152.. click:run::5354 invoke(hello, ['--help'], prog_name='python hello.py')5556You can get the library directly from PyPI::5758 pip install click5960Documentation61-------------6263This part of the documentation guides you through all of the library's64usage patterns.6566.. toctree::67 :maxdepth: 26869 why70 quickstart71 setuptools72 parameters73 options74 arguments75 commands76 prompts77 documentation78 complex79 advanced80 testing81 utils82 bashcomplete83 exceptions84 python385 wincmd8687API Reference88-------------8990If you are looking for information on a specific function, class, or91method, this part of the documentation is for you.9293.. toctree::94 :maxdepth: 29596 api9798Miscellaneous Pages99-------------------100101.. toctree::102 :maxdepth: 2103104 contrib105 changelog106 upgrading107 license