Skip to content

Base

AliasGroup (Group)

get_command(self, ctx, cmd_name)

override default with the functionalitity to lookup for aliases

Source code in camundactl/cmd/base.py
def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Command]:
    """
    override default with the functionalitity
    to lookup for aliases
    """
    if cmd := super().get_command(ctx, cmd_name):
        return cmd
    alias_lookup = self.get_alias_lookup()
    if alias_name := alias_lookup.get(cmd_name):
        if cmd := super().get_command(ctx, alias_name):
            return cmd
    for cmd_other_name in self.list_commands(ctx):
        cmd = super().get_command(ctx, cmd_other_name)
        if alias := getattr(cmd, "alias", None):
            if isinstance(alias, list) and cmd_name in alias:
                return cmd
            if isinstance(alias, str) and cmd_name == alias:
                return cmd
    return None