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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of cli; 5 part of cli;
6 6
7 // Splits a line into a list of string args. 7 // Splits a line into a list of string args.
8 List<String> _splitLine(String line) { 8 List<String> _splitLine(String line) {
9 var args = line.split(' ').where((arg) { 9 var args = line.split(' ').where((arg) {
10 return arg != ' ' && arg != ''; 10 return arg != ' ' && arg != '';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // TODO(turnidge): Add a proper exception class for this. 157 // TODO(turnidge): Add a proper exception class for this.
158 return new Future.error('notfound'); 158 return new Future.error('notfound');
159 } else if (commands.length == 1) { 159 } else if (commands.length == 1) {
160 return commands[0].run(args.sublist(commands[0]._depth)); 160 return commands[0].run(args.sublist(commands[0]._depth));
161 } else { 161 } else {
162 // TODO(turnidge): Add a proper exception class for this. 162 // TODO(turnidge): Add a proper exception class for this.
163 return new Future.error('ambiguous'); 163 return new Future.error('ambiguous');
164 } 164 }
165 } 165 }
166 166
167 // Find all matching commands. Useful for implementing help systems.
168 List<Command> matchCommand(List<String> args, bool preferExact) {
169 if (args.isEmpty) {
170 // Adding an empty string to the end causes us to match all
171 // subcommands of the last command.
172 args.add('');
173 }
174 return _match(args, preferExact);
175 }
176
167 Future run(List<String> args) { 177 Future run(List<String> args) {
168 throw 'should-not-execute-the-root-command'; 178 throw 'should-not-execute-the-root-command';
169 } 179 }
170 180
171 toString() => 'RootCommand'; 181 toString() => 'RootCommand';
172 } 182 }
173 183
174 // A node in the command tree. 184 // A node in the command tree.
175 abstract class Command extends _CommandBase { 185 abstract class Command extends _CommandBase {
176 Command(this.name, List<Command> children) : super(children); 186 Command(this.name, List<Command> children) : super(children);
177 187
178 final name; 188 final String name;
189 String get fullName {
190 if (_parent is RootCommand) {
191 return name;
192 } else {
193 return '${_parent.fullName} $name';
194 }
195 }
179 196
180 toString() => 'Command(${name})'; 197 toString() => 'Command(${name})';
181 } 198 }
OLDNEW
« 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