| OLD | NEW |
| 1 # Copyright (c) 2016 Google Inc. All rights reserved. | 1 # Copyright (c) 2016 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 from webkitpy.tool.commands.command import Command | 31 from webkitpy.tool.commands.command import Command |
| 32 | 32 |
| 33 | 33 |
| 34 class HelpCommand(Command): | 34 class HelpCommand(Command): |
| 35 name = "help" | 35 name = "help" |
| 36 help_text = "Display information about this program or its subcommands" | 36 help_text = "Display information about this program or its subcommands" |
| 37 argument_names = "[COMMAND]" | 37 argument_names = "[COMMAND]" |
| 38 | 38 |
| 39 def __init__(self): | 39 def __init__(self): |
| 40 options = [ | 40 options = [ |
| 41 optparse.make_option("-a", "--all-commands", action="store_true", de
st="show_all_commands", help="Print all available commands"), | 41 optparse.make_option( |
| 42 "-a", |
| 43 "--all-commands", |
| 44 action="store_true", |
| 45 dest="show_all_commands", |
| 46 help="Print all available commands"), |
| 42 ] | 47 ] |
| 43 super(HelpCommand, self).__init__(options) | 48 super(HelpCommand, self).__init__(options) |
| 44 # A hack used to pass --all-commands to _help_epilog even though it's ca
lled by the OptionParser. | 49 # A hack used to pass --all-commands to _help_epilog even though it's ca
lled by the OptionParser. |
| 45 self.show_all_commands = False | 50 self.show_all_commands = False |
| 46 | 51 |
| 47 def _help_epilog(self): | 52 def _help_epilog(self): |
| 48 # Only show commands which are relevant to this checkout's SCM system.
Might this be confusing to some users? | 53 # Only show commands which are relevant to this checkout's SCM system.
Might this be confusing to some users? |
| 49 if self.show_all_commands: | 54 if self.show_all_commands: |
| 50 epilog = "All %prog commands:\n" | 55 epilog = "All %prog commands:\n" |
| 51 relevant_commands = self._tool.commands[:] | 56 relevant_commands = self._tool.commands[:] |
| (...skipping 19 matching lines...) Expand all Loading... |
| 71 command = self._tool.command_by_name(args[0]) | 76 command = self._tool.command_by_name(args[0]) |
| 72 if command: | 77 if command: |
| 73 # TODO(qyearsley): Replace print with _log.info | 78 # TODO(qyearsley): Replace print with _log.info |
| 74 print command.standalone_help() # pylint: disable=print-stateme
nt | 79 print command.standalone_help() # pylint: disable=print-stateme
nt |
| 75 return 0 | 80 return 0 |
| 76 | 81 |
| 77 self.show_all_commands = options.show_all_commands | 82 self.show_all_commands = options.show_all_commands |
| 78 self._remove_help_options() | 83 self._remove_help_options() |
| 79 self.option_parser.print_help() | 84 self.option_parser.print_help() |
| 80 return 0 | 85 return 0 |
| OLD | NEW |