Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: tools/telemetry/telemetry/test_runner.py

Issue 309553008: Add command argument to perf test_runner.py help command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/command_line.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/test_runner.py
diff --git a/tools/telemetry/telemetry/test_runner.py b/tools/telemetry/telemetry/test_runner.py
index 95437c5b2f8f9fe80924b22d20080b750279b9eb..f2c6643847ac02c897494ee11bab8ed3202bd2d6 100644
--- a/tools/telemetry/telemetry/test_runner.py
+++ b/tools/telemetry/telemetry/test_runner.py
@@ -35,14 +35,27 @@ class Deps(find_dependencies.FindDependenciesCommand):
class Help(command_line.OptparseCommand):
- """Display help information"""
+ """Display help information about a command"""
+
+ usage = '[command]'
def Run(self, args):
+ if len(args.positional_args) == 1:
+ commands = _MatchingCommands(args.positional_args[0])
+ if len(commands) == 1:
+ command = commands[0]
+ parser = command.CreateParser()
+ command.AddCommandLineArgs(parser)
+ parser.print_help()
+ return 0
+
print >> sys.stderr, ('usage: %s <command> [<options>]' % _ScriptName())
print >> sys.stderr, 'Available commands are:'
for command in _Commands():
print >> sys.stderr, ' %-10s %s' % (
command.Name(), command.Description())
+ print >> sys.stderr, ('"%s help <command>" to see usage information '
+ 'for a specific command.' % _ScriptName())
return 0
@@ -177,6 +190,9 @@ def _Commands():
continue
yield cls
+def _MatchingCommands(string):
+ return [command for command in _Commands()
+ if command.Name().startswith(string)]
@decorators.Cache
def _Tests():
@@ -260,8 +276,7 @@ def main():
break
# Validate and interpret the command name.
- commands = [command for command in _Commands()
- if command.Name().startswith(command_name)]
+ commands = _MatchingCommands(command_name)
if len(commands) > 1:
print >> sys.stderr, ('"%s" is not a %s command. Did you mean one of these?'
% (command_name, _ScriptName()))
« no previous file with comments | « tools/telemetry/telemetry/core/command_line.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698