A powerful extension for Click that adds command and group aliasing support with automatic async function handling and advanced parameter validation.
You can find the project on PyPi.
- Command Aliases: Create multiple names for your commands
 - Group Aliases: Add aliases to command groups
 - Help Alias (-h): Automatic 
-hshorthand for--helpwith conflict detection - Enhanced Options & Arguments: Mutual exclusivity, requirements, and group constraints
 - Validation Rules: Group-level validation with multiple modes (all_or_none, at_least, at_most, exactly)
 - Automatic Async Support: Seamlessly handle async functions without extra configuration
 - Drop-in Replacement: Works exactly like standard Click decorators
 - Type Safe: Full type hints support with proper IDE integration
 - Help Integration: Aliases automatically appear in help text
 
pip install click-with-aliasingRequirements: Python 3.10 or newer
- Command - Command decorator with aliasing support
 - Group - Group decorator for organizing commands
 - Option - Enhanced options with mutual exclusivity and requirements
 - Argument - Enhanced arguments with validation constraints
 - Rule - Group-level validation rules for complex parameter logic
 
Note: Both
-hand--helpflags are supported by default. See the Command and Group documentation for details on how-his intelligently handled when commands use it for other purposes.
from click_with_aliasing import command
@command(name="deploy", aliases=["d", "dep"])
def deploy():
    """Deploy the application"""
    print("Deploying application...")Now you can run any of these:
my-cli deploy
my-cli d
my-cli depfrom click_with_aliasing import group, command
@group(name="database", aliases=["db"])
def database():
    """Database management commands"""
    pass
@command(name="migrate", aliases=["m"])
def migrate():
    """Run database migrations"""
    print("Running migrations...")
database.add_command(migrate)Usage:
my-cli database migrate  # Full names
my-cli db m              # Using aliases
my-cli database m        # Mixed usagefrom click_with_aliasing import command, option
@command(name="auth")
@option("--username", requires=["password"], mutually_exclusive=["token"])
@option("--password", requires=["username"], mutually_exclusive=["token"])
@option("--token", mutually_exclusive=["username", "password"])
def auth(username, password, token):
    """Authenticate with username/password or token"""
    if token:
        print("Authenticating with token")
    elif username and password:
        print(f"Authenticating as {username}")Usage:
my-cli auth --token abc123                          # Valid
my-cli auth --username admin --password secret      # Valid
my-cli auth --username admin                        # Error: requires password
my-cli auth --token abc123 --username admin         # Error: mutually exclusivefrom click_with_aliasing import command, option, rule
@command(name="deploy")
@option("--production", is_flag=True)
@option("--staging", is_flag=True)
@option("--development", is_flag=True)
@rule(["production", "staging", "development"], mode="exactly", count=1)
def deploy(production, staging, development):
    """Deploy to exactly one environment"""
    env = "production" if production else "staging" if staging else "development"
    print(f"Deploying to {env}")Usage:
my-cli deploy --production                          # Valid
my-cli deploy --staging                             # Valid
my-cli deploy --production --staging                # Error: exactly 1 required
my-cli deploy                                       # Error: exactly 1 requiredThe library automatically detects and handles async functions, meaning no extra configuration is needed.
import asyncio
from click_with_aliasing import command
@command(name="fetch", aliases=["f"])
async def fetch():
    """Fetch data asynchronously"""
    await asyncio.sleep(1)
    print("Data fetched!")import asyncio
from click_with_aliasing import group, command
@group(name="api", aliases=["a"])
async def api_group():
    """API management commands"""
    await asyncio.sleep(0.1)  # Simulate async setup
@command(name="start", aliases=["s"])
async def start_server():
    """Start the API server"""
    print("Starting server...")
api_group.add_command(start_server)Add multiple names to commands and groups for convenience:
@command(name="deploy", aliases=["d", "dep"])
@group(name="database", aliases=["db", "d"])Mutual Exclusivity: Only one option from a set can be used
@option("--json", mutually_exclusive=["xml", "yaml"])Requirements: Options that must be used together
@option("--username", requires=["password"])Group Constraints: Organize options and apply constraints collectively
@option("--json", group="format", group_mutually_exclusive=["output"])Apply group-level validation with different modes:
- all_or_none: All parameters or none
 - at_least: Minimum number required
 - at_most: Maximum number allowed
 - exactly: Exact number required
 
@rule(["host", "port", "database"], mode="all_or_none")
@rule(["email", "sms", "slack"], mode="at_least", count=1)
@rule(["json", "xml", "yaml"], mode="at_most", count=1)
@rule(["file1", "file2", "file3"], mode="exactly", count=2)Migrating from standard Click is straightforward - just change your imports:
import click
@click.group()
def cli():
    pass
@click.command()
@click.option("--name", default="World")
@click.argument("file")
def greet(name, file):
    passfrom click_with_aliasing import group, command, option, argument
@group(aliases=["c"])
def cli():
    pass
@command(name="greet", aliases=["g"])
@option("--name", default="World", mutually_exclusive=["file"])
@argument("file", required=False, mutually_exclusive=["name"])
def greet(name, file):
    passAll standard Click features work exactly the same, with optional enhancements available.
Aliases automatically appear in help text, and both -h and --help work for displaying help:
myapp database --help
Usage: myapp database [OPTIONS] COMMAND [ARGS]...
  Database management commands
Options:
  -h, --help  Show this message and exit.
Commands:
  migrate (m, mig)  Run database migrations
  seed (s)          Seed the databaseThe -h flag is automatically added unless a command uses it for another purpose (like --host), ensuring consistent help access while avoiding conflicts.
Contributions are welcome! Please read our Contributing Guide for details on our development process, coding standards, and how to submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Built on top of the great Click library by the Pallets team.