diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-25 15:12:37 -0500 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2020-03-17 00:08:52 +0000 |
commit | d3639c53d56feaea81474ffd28395a124744dab7 (patch) | |
tree | e48227c75bb55a08c342f0a2d8e6ced9cadad5a7 /subcmds/__init__.py | |
parent | f725e548db17281037d794f18aab3320d2580865 (diff) | |
download | git-repo-d3639c53d56feaea81474ffd28395a124744dab7.tar.gz |
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 <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'subcmds/__init__.py')
-rw-r--r-- | subcmds/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
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): | |||
46 | cmd.NAME = name | 46 | cmd.NAME = name |
47 | all_commands[name] = cmd | 47 | all_commands[name] = cmd |
48 | 48 | ||
49 | if 'help' in all_commands: | 49 | # Add 'branch' as an alias for 'branches'. |
50 | all_commands['help'].commands = all_commands | 50 | all_commands['branch'] = all_commands['branches'] |