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 707fdea4c1592f5dbe612908a9c4868d19361f7d..7c065c887dafae9393eff39598b6046555f1957f 100644 |
--- a/sdk/lib/_internal/pub/lib/src/command/global_run.dart |
+++ b/sdk/lib/_internal/pub/lib/src/command/global_run.dart |
@@ -26,20 +26,25 @@ class GlobalRunCommand extends PubCommand { |
bool get allowTrailingOptions => false; |
String get description => |
"Run an executable from a globally activated package."; |
- String get usage => "pub global run <package> <executable> [args...]"; |
+ String get usage => "pub global run <package>:<executable> [args...]"; |
Future onRun() { |
if (commandOptions.rest.isEmpty) { |
- usageError("Must specify a package and executable to run."); |
+ usageError("Must specify an executable to run."); |
} |
- if (commandOptions.rest.length == 1) { |
- usageError("Must specify an executable to run."); |
+ var package; |
+ var executable = commandOptions.rest[0]; |
+ if (executable.contains(":")) { |
+ var parts = split1(executable, ":"); |
+ package = parts[0]; |
+ executable = parts[1]; |
+ } else { |
+ // If the package name is omitted, use the same name for both. |
+ package = executable; |
} |
- var package = commandOptions.rest[0]; |
- var executable = commandOptions.rest[1]; |
- var args = commandOptions.rest.skip(2); |
+ var args = commandOptions.rest.skip(1).toList(); |
return globals.find(package).then((entrypoint) { |
return runExecutable(this, entrypoint, package, executable, args); |