From 0db91e220517c767e1e81fd37d1dd7ce83fa77b7 Mon Sep 17 00:00:00 2001 From: David Lord Date: Wed, 19 May 2021 10:39:53 -0700 Subject: return resolved name, not original name --- examples/aliases/aliases.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples') diff --git a/examples/aliases/aliases.py b/examples/aliases/aliases.py index c3da657..af3caa6 100644 --- a/examples/aliases/aliases.py +++ b/examples/aliases/aliases.py @@ -67,6 +67,11 @@ class AliasedGroup(click.Group): return click.Group.get_command(self, ctx, matches[0]) ctx.fail(f"Too many matches: {', '.join(sorted(matches))}") + def resolve_command(self, ctx, args): + # always return the command's name, not the alias + _, cmd, args = super().resolve_command(ctx, args) + return cmd.name, cmd, args + def read_config(ctx, param, value): """Callback that is used whenever --config is passed. We use this to -- cgit v1.2.1