README.rst 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. \$ click\_
  2. ==========
  3. Click is a Python package for creating beautiful command line interfaces
  4. in a composable way with as little code as necessary. It's the "Command
  5. Line Interface Creation Kit". It's highly configurable but comes with
  6. sensible defaults out of the box.
  7. It aims to make the process of writing command line tools quick and fun
  8. while also preventing any frustration caused by the inability to
  9. implement an intended CLI API.
  10. Click in three points:
  11. - Arbitrary nesting of commands
  12. - Automatic help page generation
  13. - Supports lazy loading of subcommands at runtime
  14. Installing
  15. ----------
  16. Install and update using `pip`_:
  17. .. code-block:: text
  18. $ pip install -U click
  19. .. _pip: https://pip.pypa.io/en/stable/getting-started/
  20. A Simple Example
  21. ----------------
  22. .. code-block:: python
  23. import click
  24. @click.command()
  25. @click.option("--count", default=1, help="Number of greetings.")
  26. @click.option("--name", prompt="Your name", help="The person to greet.")
  27. def hello(count, name):
  28. """Simple program that greets NAME for a total of COUNT times."""
  29. for _ in range(count):
  30. click.echo(f"Hello, {name}!")
  31. if __name__ == '__main__':
  32. hello()
  33. .. code-block:: text
  34. $ python hello.py --count=3
  35. Your name: Click
  36. Hello, Click!
  37. Hello, Click!
  38. Hello, Click!
  39. Donate
  40. ------
  41. The Pallets organization develops and supports Click and other popular
  42. packages. In order to grow the community of contributors and users, and
  43. allow the maintainers to devote more time to the projects, `please
  44. donate today`_.
  45. .. _please donate today: https://palletsprojects.com/donate
  46. Links
  47. -----
  48. - Documentation: https://click.palletsprojects.com/
  49. - Changes: https://click.palletsprojects.com/changes/
  50. - PyPI Releases: https://pypi.org/project/click/
  51. - Source Code: https://github.com/pallets/click
  52. - Issue Tracker: https://github.com/pallets/click/issues
  53. - Chat: https://discord.gg/pallets