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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/global_activate.dart

Issue 566093003: Create binstubs for executables when activating a package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 years, 3 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_activate.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart b/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
index 8448af58e84ce72f61a0b730b6d3784ae7f1e9c1..5f451f9150a776de8ede1b9e2465fd1ee57787a3 100644
--- a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
@@ -22,9 +22,33 @@ class GlobalActivateCommand extends PubCommand {
help: "The source used to find the package.",
allowed: ["git", "hosted", "path"],
defaultsTo: "hosted");
+
+ commandParser.addFlag("no-executables", negatable: false,
+ help: "Do not put executables on PATH.");
+
+ commandParser.addOption("executable", abbr: "x",
+ help: "Executable(s) to place on PATH.",
+ allowMultiple: true);
+
+ commandParser.addFlag("overwrite-executables", negatable: false,
+ help: "Overwrite executables from other packages with the same name.");
}
Future onRun() {
+ // Default to `null`, which means all executables.
+ var executables;
+ if (commandOptions.wasParsed("executable")) {
+ if (commandOptions.wasParsed("no-executables")) {
+ usageError("Cannot pass both --no-executables and --executable.");
+ }
+
+ executables = commandOptions["executable"];
+ } else if (commandOptions["no-executables"]) {
+ // An empty list means no executables.
+ executables = [];
+ }
+
+ var overwrite = commandOptions["overwrite-executables"];
var args = commandOptions.rest;
readArg([String error]) {
@@ -46,7 +70,8 @@ class GlobalActivateCommand extends PubCommand {
var repo = readArg("No Git repository given.");
// TODO(rnystrom): Allow passing in a Git ref too.
validateNoExtraArgs();
- return globals.activateGit(repo);
+ return globals.activateGit(repo, executables,
+ overwriteBinStubs: overwrite);
case "hosted":
var package = readArg("No package to activate given.");
@@ -62,12 +87,14 @@ class GlobalActivateCommand extends PubCommand {
}
validateNoExtraArgs();
- return globals.activateHosted(package, constraint);
+ return globals.activateHosted(package, constraint, executables,
+ overwriteBinStubs: overwrite);
case "path":
var path = readArg("No package to activate given.");
validateNoExtraArgs();
- return globals.activatePath(path);
+ return globals.activatePath(path, executables,
+ overwriteBinStubs: overwrite);
}
throw "unreachable";

Powered by Google App Engine
This is Rietveld 408576698