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

Side by Side Diff: pkg/args/lib/command_runner.dart

Issue 812743002: Fix the built-in help command in args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « pkg/args/CHANGELOG.md ('k') | pkg/args/lib/src/help_command.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library args.command_runner; 5 library args.command_runner;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 usageException( 150 usageException(
151 'Could not find a command named "${argResults.rest[0]}".'); 151 'Could not find a command named "${argResults.rest[0]}".');
152 } 152 }
153 153
154 command.usageException('Could not find a subcommand named ' 154 command.usageException('Could not find a subcommand named '
155 '"${argResults.rest[0]}" for "$commandString".'); 155 '"${argResults.rest[0]}" for "$commandString".');
156 } 156 }
157 } 157 }
158 158
159 // Step into the command. 159 // Step into the command.
160 var parent = command;
161 argResults = argResults.command; 160 argResults = argResults.command;
162 command = commands[argResults.name]; 161 command = commands[argResults.name];
163 command._globalResults = topLevelResults; 162 command._globalResults = topLevelResults;
164 command._argResults = argResults; 163 command._argResults = argResults;
165 commands = command._subcommands; 164 commands = command._subcommands;
166 commandString += " ${argResults.name}"; 165 commandString += " ${argResults.name}";
167 166
168 if (argResults['help']) { 167 if (argResults['help']) {
169 command.printUsage(); 168 command.printUsage();
170 return new Future.value(); 169 return new Future.value();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 var buffer = new StringBuffer( 375 var buffer = new StringBuffer(
377 'Available ${isSubcommand ? "sub" : ""}commands:'); 376 'Available ${isSubcommand ? "sub" : ""}commands:');
378 for (var name in names) { 377 for (var name in names) {
379 buffer.writeln(); 378 buffer.writeln();
380 buffer.write(' ${padRight(name, length)} ' 379 buffer.write(' ${padRight(name, length)} '
381 '${commands[name].description.split("\n").first}'); 380 '${commands[name].description.split("\n").first}');
382 } 381 }
383 382
384 return buffer.toString(); 383 return buffer.toString();
385 } 384 }
OLDNEW
« no previous file with comments | « pkg/args/CHANGELOG.md ('k') | pkg/args/lib/src/help_command.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698