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

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

Issue 993613002: Implement 'print', 'up', 'down', and 'frame' commands in the Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 9 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 | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/src/debugger/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 295c743bb9722565dfba88b46fdbe4d4f1a32b9f..67b21c23504c8102a2b76161b944078d005f9d1d 100644
--- a/runtime/observatory/lib/src/cli/command.dart
+++ b/runtime/observatory/lib/src/cli/command.dart
@@ -4,11 +4,26 @@
part of cli;
-// Splits a line into a list of string args.
+// Splits a line into a list of string args. Each arg retains any
+// trailing whitespace so that we can reconstruct the original command
+// line from the pieces.
List<String> _splitLine(String line) {
- var args = line.split(' ').where((arg) {
- return arg != ' ' && arg != '';
- }).toList();
+ line = line.trimLeft();
+ var args = [];
+ var codes = line.codeUnits;
+
+ int pos = 0;
+ while (pos < line.length) {
+ int startPos = pos;
+
+ // Advance to end of word.
+ for (; pos < line.length && line[pos] != ' '; pos++);
+
+ // Advance to end of spaces.
+ for (; pos < line.length && line[pos] == ' '; pos++);
+
+ args.add(line.substring(startPos, pos));
+ }
return args;
}
@@ -17,7 +32,7 @@ String _concatArgs(List<String> args, int count) {
if (count == 0) {
return '';
}
- return '${args.sublist(0, count).join(" ")} ';
+ return '${args.sublist(0, count).join('')}';
}
// Shared functionality for RootCommand and Command.
@@ -46,8 +61,9 @@ abstract class _CommandBase {
Future run(List<String> args);
// Returns a list of local subcommands which match the args.
- List<Command> _matchLocal(String arg, bool preferExact) {
+ List<Command> _matchLocal(String argWithSpace, bool preferExact) {
var matches = new List<Command>();
+ var arg = argWithSpace.trimRight();
for (var child in _children) {
if (child.name.startsWith(arg)) {
if (preferExact && ((child.name == arg) || (child.alias == arg))) {
« no previous file with comments | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/src/debugger/debugger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698