From d3639c53d56feaea81474ffd28395a124744dab7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 25 Feb 2020 15:12:37 -0500 Subject: subcmds: centralize all_commands logic The branch->branches alias is setup in the main module when that really belongs in the existing all_commands setup. For help, rather than monkey patching all_commands to the class, switch it to use the state directly from the module. This makes it a bit more obvious where it's coming from rather than this one subcommand having a |commands| member added externally to it. Change-Id: I0200def09bf4774cad8012af0f4ae60ea3089dc0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259153 Tested-by: Mike Frysinger Reviewed-by: David Pursehouse --- subcmds/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'subcmds/__init__.py') diff --git a/subcmds/__init__.py b/subcmds/__init__.py index 9cc94718..a49e7bd3 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py @@ -46,5 +46,5 @@ for py in os.listdir(my_dir): cmd.NAME = name all_commands[name] = cmd -if 'help' in all_commands: - all_commands['help'].commands = all_commands +# Add 'branch' as an alias for 'branches'. +all_commands['branch'] = all_commands['branches'] -- cgit v1.2.3-54-g00ecf