This is a project that adds decorators that wraps the default click.group
and click.command
decorators with custom ones that support aliasing.
You can install the package from PyPI:
pip install click-with-aliasing
The package is available for Python 3.11 and newer.
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.
Here is an example of how to use the group
decorator:
from click_with_aliasing import group
from .my_command import my_command
@group(name="my_group", aliases=['mg'])
def cli():
""" My Click group """
cli.add_command(my_command)
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.
The same works for the command
decorator:
from click_with_aliasing import command
@command(name="my_command", aliases=['mc'])
def my_command():
""" My Click command """
...
Like the group, you can call the command using either my_command
or mc
.
You can now call the command using mg mc
or any combination of the aliases.
This project is licensed under the MIT License - see the LICENSE file for details.