diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/__init__.py | 3 | ||||
| -rw-r--r-- | subcmds/help.py | 6 | ||||
| -rw-r--r-- | subcmds/version.py | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/subcmds/__init__.py b/subcmds/__init__.py index a49e7bd3..c3de9d1e 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | import os | 17 | import os |
| 18 | 18 | ||
| 19 | # A mapping of the subcommand name to the class that implements it. | ||
| 19 | all_commands = {} | 20 | all_commands = {} |
| 20 | 21 | ||
| 21 | my_dir = os.path.dirname(__file__) | 22 | my_dir = os.path.dirname(__file__) |
| @@ -37,7 +38,7 @@ for py in os.listdir(my_dir): | |||
| 37 | ['%s' % name]) | 38 | ['%s' % name]) |
| 38 | mod = getattr(mod, name) | 39 | mod = getattr(mod, name) |
| 39 | try: | 40 | try: |
| 40 | cmd = getattr(mod, clsn)() | 41 | cmd = getattr(mod, clsn) |
| 41 | except AttributeError: | 42 | except AttributeError: |
| 42 | raise SyntaxError('%s/%s does not define class %s' % ( | 43 | raise SyntaxError('%s/%s does not define class %s' % ( |
| 43 | __name__, py, clsn)) | 44 | __name__, py, clsn)) |
diff --git a/subcmds/help.py b/subcmds/help.py index 5e24ed0b..1e16019a 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -43,7 +43,7 @@ Displays detailed usage information about a command. | |||
| 43 | fmt = ' %%-%ds %%s' % maxlen | 43 | fmt = ' %%-%ds %%s' % maxlen |
| 44 | 44 | ||
| 45 | for name in commandNames: | 45 | for name in commandNames: |
| 46 | command = all_commands[name] | 46 | command = all_commands[name]() |
| 47 | try: | 47 | try: |
| 48 | summary = command.helpSummary.strip() | 48 | summary = command.helpSummary.strip() |
| 49 | except AttributeError: | 49 | except AttributeError: |
| @@ -134,7 +134,7 @@ Displays detailed usage information about a command. | |||
| 134 | 134 | ||
| 135 | def _PrintAllCommandHelp(self): | 135 | def _PrintAllCommandHelp(self): |
| 136 | for name in sorted(all_commands): | 136 | for name in sorted(all_commands): |
| 137 | cmd = all_commands[name] | 137 | cmd = all_commands[name]() |
| 138 | cmd.manifest = self.manifest | 138 | cmd.manifest = self.manifest |
| 139 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) | 139 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) |
| 140 | 140 | ||
| @@ -159,7 +159,7 @@ Displays detailed usage information about a command. | |||
| 159 | name = args[0] | 159 | name = args[0] |
| 160 | 160 | ||
| 161 | try: | 161 | try: |
| 162 | cmd = all_commands[name] | 162 | cmd = all_commands[name]() |
| 163 | except KeyError: | 163 | except KeyError: |
| 164 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) | 164 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) |
| 165 | sys.exit(1) | 165 | sys.exit(1) |
diff --git a/subcmds/version.py b/subcmds/version.py index 91dbe68f..8721bf49 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
| @@ -44,9 +44,9 @@ class Version(Command, MirrorSafeCommand): | |||
| 44 | print('repo version %s' % rp_ver) | 44 | print('repo version %s' % rp_ver) |
| 45 | print(' (from %s)' % rem.url) | 45 | print(' (from %s)' % rem.url) |
| 46 | 46 | ||
| 47 | if Version.wrapper_path is not None: | 47 | if self.wrapper_path is not None: |
| 48 | print('repo launcher version %s' % Version.wrapper_version) | 48 | print('repo launcher version %s' % self.wrapper_version) |
| 49 | print(' (from %s)' % Version.wrapper_path) | 49 | print(' (from %s)' % self.wrapper_path) |
| 50 | 50 | ||
| 51 | if src_ver != rp_ver: | 51 | if src_ver != rp_ver: |
| 52 | print(' (currently at %s)' % src_ver) | 52 | print(' (currently at %s)' % src_ver) |
