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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/global_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/global_run.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_run.dart b/sdk/lib/_internal/pub/lib/src/command/global_run.dart
index 06783e5103db7cb129acaa5122b734d8988fe8a7..7fc07a7aa5792794506057705746ac7e8bb946c2 100644
--- a/sdk/lib/_internal/pub/lib/src/command/global_run.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/global_run.dart
@@ -15,28 +15,28 @@ import '../utils.dart';
/// Handles the `global run` pub command.
class GlobalRunCommand extends PubCommand {
- bool get takesArguments => true;
- bool get allowTrailingOptions => false;
+ String get name => "run";
String get description =>
"Run an executable from a globally activated package.\n"
"NOTE: We are currently optimizing this command's startup time.";
- String get usage => "pub global run <package>:<executable> [args...]";
+ String get invocation => "pub global run <package>:<executable> [args...]";
+ bool get allowTrailingOptions => false;
/// The mode for barback transformers.
- BarbackMode get mode => new BarbackMode(commandOptions["mode"]);
+ BarbackMode get mode => new BarbackMode(argResults["mode"]);
GlobalRunCommand() {
- commandParser.addOption("mode", defaultsTo: "release",
+ argParser.addOption("mode", defaultsTo: "release",
help: 'Mode to run transformers in.');
}
- 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;
- var executable = commandOptions.rest[0];
+ var executable = argResults.rest[0];
if (executable.contains(":")) {
var parts = split1(executable, ":");
package = parts[0];
@@ -46,11 +46,11 @@ class GlobalRunCommand extends PubCommand {
package = executable;
}
- var args = commandOptions.rest.skip(1).toList();
+ var args = argResults.rest.skip(1).toList();
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 global ' +
+ usageException('Cannot run an executable in a subdirectory of a global ' +
'package.');
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/global_list.dart ('k') | sdk/lib/_internal/pub/lib/src/command/help.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698