Skip to content

Command aliases #132

@max-block

Description

@max-block

It would be nice to have command aliases, when all these commands do the same thing:

my-app delete
my-app uninstall
my-app d

There is a module for click which can do it: https://github.com/click-contrib/click-aliases

Code looks like this:

import click
from click_aliases import ClickAliasedGroup


@click.group(cls=ClickAliasedGroup)
def cli():
    pass


@cli.command(aliases=["i", "inst"])
def install():
    click.echo("install")


@cli.command(aliases=["d", "uninstall", "remove"])
def delete():
    click.echo("delete")

Also this module click-aliases add info about alises to help:

Usage: t3 [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  delete (d,remove,uninstall)
  install (i,inst)

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredfeatureNew feature, enhancement or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions