|
1 | 1 | # Click With Aliasing
|
2 | 2 |
|
3 |
| -Easily add aliases to your Click groups and commands. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +This is a project that adds decorators that replaces the default `click.group` and `click.command` decorators with custom ones that support aliasing. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +You can install the package from [PyPI](https://pypi.org/project/click-with-aliasing/): |
| 19 | + |
| 20 | +```bash |
| 21 | +pip install click-with-aliasing |
| 22 | +``` |
| 23 | + |
| 24 | +The package is available for Python 3.11 and newer. |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +The package provides two decorators: `group` and `command`. They work exactly like the original `click.group` and `click.command` decorators, but they also support aliasing using the `aliases` argument. |
| 29 | + |
| 30 | +Here is an example of how to use the `group` decorator: |
| 31 | + |
| 32 | +```python |
| 33 | +from click_with_aliasing import group |
| 34 | + |
| 35 | +@group(name="my_group", aliases=['mg']) |
| 36 | +def cli(): |
| 37 | + """ My Click group """ |
| 38 | +``` |
| 39 | + |
| 40 | +This group works exactly like a normal `click.group`, but while using the CLI, you can use either `my_group` or `mg` to call the group. |
| 41 | + |
| 42 | +The same works for the `command` decorator: |
| 43 | + |
| 44 | +```python |
| 45 | +from click_with_aliasing import command |
| 46 | + |
| 47 | +@command(name="my_command", aliases=['mc']) |
| 48 | +def my_command(): |
| 49 | + """ My Click command """ |
| 50 | + ... |
| 51 | +``` |
| 52 | + |
| 53 | +Like the group, you can call the command using either `my_command` or `mc`. |
| 54 | + |
| 55 | +## License |
| 56 | + |
| 57 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments