diff options
| author | Mike Frysinger <vapier@google.com> | 2021-06-14 16:17:27 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2021-06-15 06:08:13 +0000 |
| commit | d58d0dd3bf40f2c5e754c8a0a622c7d4e58425b8 (patch) | |
| tree | 37fc46209f7822a29b0879bc2aa7405323f3db4a /subcmds/help.py | |
| parent | d88b369a42462cf5fe4ff2a09b9b7b52e0ee333a (diff) | |
| download | git-repo-d58d0dd3bf40f2c5e754c8a0a622c7d4e58425b8.tar.gz | |
commands: pass settings via __init__
Instead of setting properties on the instantiated command, pass them
via the constructor like normal objects.
Change-Id: I8787499bd2be68565875ffe243c3cf2024b36ae7
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309324
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/help.py')
| -rw-r--r-- | subcmds/help.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/subcmds/help.py b/subcmds/help.py index 821f6bf6..f302e75c 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -138,8 +138,7 @@ Displays detailed usage information about a command. | |||
| 138 | 138 | ||
| 139 | def _PrintAllCommandHelp(self): | 139 | def _PrintAllCommandHelp(self): |
| 140 | for name in sorted(all_commands): | 140 | for name in sorted(all_commands): |
| 141 | cmd = all_commands[name]() | 141 | cmd = all_commands[name](manifest=self.manifest) |
| 142 | cmd.manifest = self.manifest | ||
| 143 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) | 142 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) |
| 144 | 143 | ||
| 145 | def _Options(self, p): | 144 | def _Options(self, p): |
| @@ -163,12 +162,11 @@ Displays detailed usage information about a command. | |||
| 163 | name = args[0] | 162 | name = args[0] |
| 164 | 163 | ||
| 165 | try: | 164 | try: |
| 166 | cmd = all_commands[name]() | 165 | cmd = all_commands[name](manifest=self.manifest) |
| 167 | except KeyError: | 166 | except KeyError: |
| 168 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) | 167 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) |
| 169 | sys.exit(1) | 168 | sys.exit(1) |
| 170 | 169 | ||
| 171 | cmd.manifest = self.manifest | ||
| 172 | self._PrintCommandHelp(cmd) | 170 | self._PrintCommandHelp(cmd) |
| 173 | 171 | ||
| 174 | else: | 172 | else: |
