Chromium Code Reviews

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/command/run.dart

Issue 805393002: Update pub to use the new command runner API in args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: sdk/lib/_internal/pub_generated/lib/src/command/run.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/run.dart b/sdk/lib/_internal/pub_generated/lib/src/command/run.dart
index a9fee0f745d0e3ffd26c4bfb116b92b7277478d2..0d63daf12399cc68247414d6eb624e5e3c183bc7 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/command/run.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/run.dart
@@ -16,28 +16,28 @@ import '../utils.dart';
/// Handles the `run` pub command.
class RunCommand extends PubCommand {
- bool get takesArguments => true;
- bool get allowTrailingOptions => false;
+ String get name => "run";
String get description =>
"Run an executable from a package.\n"
"NOTE: We are currently optimizing this command's startup time.";
- String get usage => "pub run <executable> [args...]";
+ String get invocation => "pub run <executable> [args...]";
+ bool get allowTrailingOptions => false;
RunCommand() {
- commandParser.addOption(
+ argParser.addOption(
"mode",
help: 'Mode to run transformers in.\n'
'(defaults to "release" for dependencies, "debug" for ' 'entrypoint)');
}
- Future onRun() {
+ Future run() {
final completer0 = new Completer();
scheduleMicrotask(() {
try {
join0() {
var package = entrypoint.root.name;
- var executable = commandOptions.rest[0];
- var args = commandOptions.rest.skip(1).toList();
+ var executable = argResults.rest[0];
+ var args = argResults.rest.skip(1).toList();
join1() {
var mode;
join2() {
@@ -58,8 +58,8 @@ class RunCommand extends PubCommand {
}
}, onError: completer0.completeError);
}
- if (commandOptions['mode'] != null) {
- mode = new BarbackMode(commandOptions['mode']);
+ if (argResults['mode'] != null) {
+ mode = new BarbackMode(argResults['mode']);
join2();
} else {
join3() {
@@ -82,7 +82,7 @@ class RunCommand extends PubCommand {
join1();
}
if (p.split(executable).length > 1) {
- usageError(
+ usageException(
"Cannot run an executable in a subdirectory of a " + "dependency.");
join4();
} else {
@@ -92,8 +92,8 @@ class RunCommand extends PubCommand {
join1();
}
}
- if (commandOptions.rest.isEmpty) {
- usageError("Must specify an executable to run.");
+ if (argResults.rest.isEmpty) {
+ usageException("Must specify an executable to run.");
join0();
} else {
join0();

Powered by Google App Engine