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

Unified Diff: runtime/observatory/lib/src/cli/command.dart

Issue 921893004: Implement 'help' command for Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/cli/command.dart
diff --git a/runtime/observatory/lib/src/cli/command.dart b/runtime/observatory/lib/src/cli/command.dart
index b015bac2cd90bb8c562436cd053568b26d362154..ce16a643666f0fe7b540504f19aaf30bda1a7aef 100644
--- a/runtime/observatory/lib/src/cli/command.dart
+++ b/runtime/observatory/lib/src/cli/command.dart
@@ -164,6 +164,16 @@ class RootCommand extends _CommandBase {
}
}
+ // Find all matching commands. Useful for implementing help systems.
+ List<Command> matchCommand(List<String> args, bool preferExact) {
+ if (args.isEmpty) {
+ // Adding an empty string to the end causes us to match all
+ // subcommands of the last command.
+ args.add('');
+ }
+ return _match(args, preferExact);
+ }
+
Future run(List<String> args) {
throw 'should-not-execute-the-root-command';
}
@@ -175,7 +185,14 @@ class RootCommand extends _CommandBase {
abstract class Command extends _CommandBase {
Command(this.name, List<Command> children) : super(children);
- final name;
+ final String name;
+ String get fullName {
+ if (_parent is RootCommand) {
+ return name;
+ } else {
+ return '${_parent.fullName} $name';
+ }
+ }
toString() => 'Command(${name})';
}
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698