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

Unified Diff: sdk/lib/_internal/pub/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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/command/run.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/run.dart b/sdk/lib/_internal/pub/lib/src/command/run.dart
index 42a0d370625ba6dac1ccb4aa2e7d7bd2ad54655b..eca10b9477c79f9dcb4cad99a48ae4df8fd76eb5 100644
--- a/sdk/lib/_internal/pub/lib/src/command/run.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/run.dart
@@ -16,27 +16,27 @@ 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("mode",
+ argParser.addOption("mode",
help: 'Mode to run transformers in.\n'
'(defaults to "release" for dependencies, "debug" for '
'entrypoint)');
}
- Future onRun() async {
- if (commandOptions.rest.isEmpty) {
- usageError("Must specify an executable to run.");
+ Future run() async {
+ if (argResults.rest.isEmpty) {
+ usageException("Must specify an executable to run.");
}
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();
// A command like "foo:bar" runs the "bar" script from the "foo" package.
// If there is no colon prefix, default to the root package.
@@ -48,14 +48,14 @@ class RunCommand extends PubCommand {
if (p.split(executable).length > 1) {
// TODO(nweiz): Use adjacent strings when the new async/await compiler
// lands.
- usageError("Cannot run an executable in a subdirectory of a " +
+ usageException("Cannot run an executable in a subdirectory of a " +
"dependency.");
}
}
var mode;
- if (commandOptions['mode'] != null) {
- mode = new BarbackMode(commandOptions['mode']);
+ if (argResults['mode'] != null) {
+ mode = new BarbackMode(argResults['mode']);
} else if (package == entrypoint.root.name) {
mode = BarbackMode.DEBUG;
} else {
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart ('k') | sdk/lib/_internal/pub/lib/src/command/serve.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698