summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/tool/multicommandtool.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/tool/multicommandtool.py')
-rw-r--r--Tools/Scripts/webkitpy/tool/multicommandtool.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/Tools/Scripts/webkitpy/tool/multicommandtool.py b/Tools/Scripts/webkitpy/tool/multicommandtool.py
index e2f91a7da..01b022f32 100644
--- a/Tools/Scripts/webkitpy/tool/multicommandtool.py
+++ b/Tools/Scripts/webkitpy/tool/multicommandtool.py
@@ -48,11 +48,12 @@ class TryAgain(Exception):
class Command(object):
name = None
show_in_main_help = False
- def __init__(self, help_text, argument_names=None, options=None, long_help=None, requires_local_commits=False):
- self.help_text = help_text
- self.long_help = long_help
- self.argument_names = argument_names
- self.required_arguments = self._parse_required_arguments(argument_names)
+ help_text = None
+ long_help = None
+ argument_names = None
+
+ def __init__(self, options=None, requires_local_commits=False):
+ self.required_arguments = self._parse_required_arguments(self.argument_names)
self.options = options
self.requires_local_commits = requires_local_commits
self._tool = None
@@ -139,15 +140,6 @@ class Command(object):
return self.check_arguments_and_execute(options, args)
-# FIXME: This should just be rolled into Command. help_text and argument_names do not need to be instance variables.
-class AbstractDeclarativeCommand(Command):
- help_text = None
- argument_names = None
- long_help = None
- def __init__(self, options=None, **kwargs):
- Command.__init__(self, self.help_text, self.argument_names, options=options, long_help=self.long_help, **kwargs)
-
-
class HelpPrintingOptionParser(OptionParser):
def __init__(self, epilog_method=None, *args, **kwargs):
self.epilog_method = epilog_method
@@ -168,7 +160,7 @@ class HelpPrintingOptionParser(OptionParser):
return ""
-class HelpCommand(AbstractDeclarativeCommand):
+class HelpCommand(Command):
name = "help"
help_text = "Display information about this program or its subcommands"
argument_names = "[COMMAND]"
@@ -177,7 +169,7 @@ class HelpCommand(AbstractDeclarativeCommand):
options = [
make_option("-a", "--all-commands", action="store_true", dest="show_all_commands", help="Print all available commands"),
]
- AbstractDeclarativeCommand.__init__(self, options)
+ Command.__init__(self, options)
self.show_all_commands = False # A hack used to pass --all-commands to _help_epilog even though it's called by the OptionParser.
def _help_epilog(self):