mirror of
https://github.com/aljazceru/Tutorial-Codebase-Knowledge.git
synced 2025-12-19 15:34:23 +01:00
44 lines
1.7 KiB
Markdown
44 lines
1.7 KiB
Markdown
# Tutorial: Click
|
|
|
|
Click is a Python library that makes creating **command-line interfaces (CLIs)** *easy and fun*.
|
|
It uses simple Python **decorators** (`@click.command`, `@click.option`, etc.) to turn your functions into CLI commands with options and arguments.
|
|
Click handles parsing user input, generating help messages, validating data types, and managing the flow between commands, letting you focus on your application's logic.
|
|
It also provides tools for *terminal interactions* like prompting users and showing progress bars.
|
|
|
|
|
|
**Source Repository:** [https://github.com/pallets/click/tree/main/src/click](https://github.com/pallets/click/tree/main/src/click)
|
|
|
|
```mermaid
|
|
flowchart TD
|
|
A0["Context"]
|
|
A1["Command / Group"]
|
|
A2["Parameter (Option / Argument)"]
|
|
A3["ParamType"]
|
|
A4["Decorators"]
|
|
A5["Term UI (Terminal User Interface)"]
|
|
A6["Click Exceptions"]
|
|
A4 -- "Creates/Configures" --> A1
|
|
A4 -- "Creates/Configures" --> A2
|
|
A0 -- "Manages execution of" --> A1
|
|
A0 -- "Holds parsed values for" --> A2
|
|
A2 -- "Uses for validation/conversion" --> A3
|
|
A3 -- "Raises on conversion error" --> A6
|
|
A1 -- "Uses for user interaction" --> A5
|
|
A0 -- "Handles/Raises" --> A6
|
|
A4 -- "Injects via @pass_context" --> A0
|
|
```
|
|
|
|
## Chapters
|
|
|
|
1. [Command / Group](01_command___group.md)
|
|
2. [Decorators](02_decorators.md)
|
|
3. [Parameter (Option / Argument)](03_parameter__option___argument_.md)
|
|
4. [ParamType](04_paramtype.md)
|
|
5. [Context](05_context.md)
|
|
6. [Term UI (Terminal User Interface)](06_term_ui__terminal_user_interface_.md)
|
|
7. [Click Exceptions](07_click_exceptions.md)
|
|
|
|
|
|
---
|
|
|
|
Generated by [AI Codebase Knowledge Builder](https://github.com/The-Pocket/Tutorial-Codebase-Knowledge) |