Chromium Code Reviews| 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..284932543482de2aafcb453568d6e5128ca0f09e 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,27 @@ 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, |
|
nweiz
2014/09/15 22:57:17
This is a really long and unwieldy flag name. I li
Bob Nystrom
2014/09/17 21:34:34
I did that at first but I felt like "force" was am
nweiz
2014/09/17 22:58:26
What do you think about just "--overwrite"?
Bob Nystrom
2014/09/18 19:17:52
Maybe? I'm worried that that isn't clear. The comm
nweiz
2014/09/18 20:47:46
I think in practice most of the time users will be
Bob Nystrom
2014/09/18 22:23:47
Good point. Done.
|
| + help: "Overwrite executables from other packages with the same name."); |
| } |
| Future onRun() { |
| + var binstubs = !commandOptions["no-executables"]; |
| + var overwrite = commandOptions["overwrite-executables"]; |
| + var executables = commandOptions["executable"]; |
| + |
| + if (!binstubs && executables.isNotEmpty) { |
| + usageError("Cannot pass both --no-executables and --executable."); |
| + } |
| + |
| var args = commandOptions.rest; |
| readArg([String error]) { |
| @@ -46,7 +64,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, |
| + createBinStubs: binstubs, overwriteBinStubs: overwrite); |
|
nweiz
2014/09/15 22:57:17
Rather than having separate [executables] and [cre
Bob Nystrom
2014/09/17 21:34:34
Done.
|
| case "hosted": |
| var package = readArg("No package to activate given."); |
| @@ -62,12 +81,14 @@ class GlobalActivateCommand extends PubCommand { |
| } |
| validateNoExtraArgs(); |
| - return globals.activateHosted(package, constraint); |
| + return globals.activateHosted(package, constraint, executables, |
| + createBinStubs: binstubs, overwriteBinStubs: overwrite); |
| case "path": |
| var path = readArg("No package to activate given."); |
| validateNoExtraArgs(); |
| - return globals.activatePath(path); |
| + return globals.activatePath(path, executables, |
| + createBinStubs: binstubs, overwriteBinStubs: overwrite); |
| } |
| throw "unreachable"; |