{"id":2890,"library":"click-aliases","title":"Click Aliases","description":"click-aliases is a Python library that extends Click, a popular CLI creation kit, by allowing developers to assign multiple distinct aliases to commands and groups. It addresses Click's lack of built-in 'true' command aliasing (beyond prefix matching) by providing a custom group class. The current version is 1.0.5, released in October 2024, and it generally follows a maintenance release cadence.","status":"active","version":"1.0.5","language":"en","source_language":"en","source_url":"https://github.com/click-contrib/click-aliases","tags":["cli","click","aliases","command-line-interface"],"install":[{"cmd":"pip install click-aliases","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"click-aliases is an extension for the Click framework, requiring it for core functionality.","package":"click","optional":false}],"imports":[{"note":"This is the primary class to import and use with @click.group(cls=ClickAliasedGroup).","symbol":"ClickAliasedGroup","correct":"from click_aliases import ClickAliasedGroup"}],"quickstart":{"code":"import click\nfrom click_aliases import ClickAliasedGroup\n\n@click.group(cls=ClickAliasedGroup)\ndef cli():\n    \"\"\"A simple CLI with aliases.\"\"\"\n    pass\n\n@cli.command(aliases=['create', 'mk'])\ndef make():\n    \"\"\"Makes something new.\"\"\"\n    click.echo('Making something...')\n\n@cli.command(aliases=['rm', 'delete'])\ndef remove():\n    \"\"\"Removes something.\"\"\"\n    click.echo('Removing something...')\n\nif __name__ == '__main__':\n    cli()","lang":"python","description":"This example demonstrates how to set up a Click CLI with `click-aliases`. The `ClickAliasedGroup` is passed as the class for the main Click group, and then individual commands can specify aliases using the `aliases` argument in the `@cli.command()` decorator."},"warnings":[{"fix":"Understand that `click-aliases` is for defining explicit, distinct alternative names for commands, not for automatically shortening command names (which Click handles to a degree).","message":"Click's native functionality supports command prefix matching (e.g., 'comm' for 'commit' if unique), but not 'true' distinct aliases. `click-aliases` provides the latter. Be aware of this distinction to avoid confusion about which form of aliasing you need.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Test thoroughly when using multiple Click extensions. For help output issues, custom `HelpFormatter` implementations or further overrides of Click's core classes might be required to integrate alias display seamlessly.","message":"When combining `click-aliases` with other Click extensions (e.g., `rich-click`), there might be conflicts or unexpected behavior, particularly regarding help text formatting. Aliases may not appear correctly or may break the formatting of individual command help.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Continue using `click-aliases` or implement custom group classes as shown in Click's advanced patterns if more fine-grained control is needed. This warning is more about Click's design philosophy than a deprecation within `click-aliases`.","message":"Click's core maintainers have previously indicated that alias functionality is covered by overridable APIs and is not planned for direct integration into Click's core. While `click-aliases` provides a convenient abstraction, users should be aware that native support for this specific aliasing pattern is unlikely to be added to Click itself.","severity":"deprecated","affected_versions":"All versions of Click and click-aliases"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}