diff options
Diffstat (limited to 'subcmds/help.py')
| -rw-r--r-- | subcmds/help.py | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/subcmds/help.py b/subcmds/help.py index 375d04d2..15aab7f9 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | # See the License for the specific language governing permissions and | 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | 15 | ||
| 16 | from __future__ import print_function | ||
| 16 | import re | 17 | import re |
| 17 | import sys | 18 | import sys |
| 18 | from formatter import AbstractFormatter, DumbWriter | 19 | from formatter import AbstractFormatter, DumbWriter |
| @@ -31,10 +32,8 @@ Displays detailed usage information about a command. | |||
| 31 | """ | 32 | """ |
| 32 | 33 | ||
| 33 | def _PrintAllCommands(self): | 34 | def _PrintAllCommands(self): |
| 34 | print 'usage: repo COMMAND [ARGS]' | 35 | print('usage: repo COMMAND [ARGS]') |
| 35 | print """ | 36 | print('The complete list of recognized repo commands are:') |
| 36 | The complete list of recognized repo commands are: | ||
| 37 | """ | ||
| 38 | commandNames = self.commands.keys() | 37 | commandNames = self.commands.keys() |
| 39 | commandNames.sort() | 38 | commandNames.sort() |
| 40 | 39 | ||
| @@ -49,17 +48,14 @@ The complete list of recognized repo commands are: | |||
| 49 | summary = command.helpSummary.strip() | 48 | summary = command.helpSummary.strip() |
| 50 | except AttributeError: | 49 | except AttributeError: |
| 51 | summary = '' | 50 | summary = '' |
| 52 | print fmt % (name, summary) | 51 | print(fmt % (name, summary)) |
| 53 | print """ | 52 | print("See 'repo help <command>' for more information on a" |
| 54 | See 'repo help <command>' for more information on a specific command. | 53 | 'specific command.') |
| 55 | """ | ||
| 56 | 54 | ||
| 57 | def _PrintCommonCommands(self): | 55 | def _PrintCommonCommands(self): |
| 58 | print 'usage: repo COMMAND [ARGS]' | 56 | print('usage: repo COMMAND [ARGS]') |
| 59 | print """ | 57 | print('The most commonly used repo commands are:') |
| 60 | The most commonly used repo commands are: | 58 | commandNames = [name |
| 61 | """ | ||
| 62 | commandNames = [name | ||
| 63 | for name in self.commands.keys() | 59 | for name in self.commands.keys() |
| 64 | if self.commands[name].common] | 60 | if self.commands[name].common] |
| 65 | commandNames.sort() | 61 | commandNames.sort() |
| @@ -75,11 +71,10 @@ The most commonly used repo commands are: | |||
| 75 | summary = command.helpSummary.strip() | 71 | summary = command.helpSummary.strip() |
| 76 | except AttributeError: | 72 | except AttributeError: |
| 77 | summary = '' | 73 | summary = '' |
| 78 | print fmt % (name, summary) | 74 | print(fmt % (name, summary)) |
| 79 | print """ | 75 | print( |
| 80 | See 'repo help <command>' for more information on a specific command. | 76 | "See 'repo help <command>' for more information on a specific command.\n" |
| 81 | See 'repo help --all' for a complete list of recognized commands. | 77 | "See 'repo help --all' for a complete list of recognized commands.") |
| 82 | """ | ||
| 83 | 78 | ||
| 84 | def _PrintCommandHelp(self, cmd): | 79 | def _PrintCommandHelp(self, cmd): |
| 85 | class _Out(Coloring): | 80 | class _Out(Coloring): |
| @@ -131,7 +126,7 @@ See 'repo help --all' for a complete list of recognized commands. | |||
| 131 | 126 | ||
| 132 | p('%s', title) | 127 | p('%s', title) |
| 133 | self.nl() | 128 | self.nl() |
| 134 | p('%s', ''.ljust(len(title),section_type[0])) | 129 | p('%s', ''.ljust(len(title), section_type[0])) |
| 135 | self.nl() | 130 | self.nl() |
| 136 | continue | 131 | continue |
| 137 | 132 | ||
| @@ -162,7 +157,7 @@ See 'repo help --all' for a complete list of recognized commands. | |||
| 162 | try: | 157 | try: |
| 163 | cmd = self.commands[name] | 158 | cmd = self.commands[name] |
| 164 | except KeyError: | 159 | except KeyError: |
| 165 | print >>sys.stderr, "repo: '%s' is not a repo command." % name | 160 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) |
| 166 | sys.exit(1) | 161 | sys.exit(1) |
| 167 | 162 | ||
| 168 | cmd.manifest = self.manifest | 163 | cmd.manifest = self.manifest |
