OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:pub_semver/pub_semver.dart'; | 7 import 'package:pub_semver/pub_semver.dart'; |
8 | 8 |
9 import '../command.dart'; | 9 import '../command.dart'; |
10 import '../utils.dart'; | 10 import '../utils.dart'; |
(...skipping 17 matching lines...) Loading... |
28 argParser.addOption("executable", abbr: "x", | 28 argParser.addOption("executable", abbr: "x", |
29 help: "Executable(s) to place on PATH.", | 29 help: "Executable(s) to place on PATH.", |
30 allowMultiple: true); | 30 allowMultiple: true); |
31 | 31 |
32 argParser.addFlag("overwrite", negatable: false, | 32 argParser.addFlag("overwrite", negatable: false, |
33 help: "Overwrite executables from other packages with the same name."); | 33 help: "Overwrite executables from other packages with the same name."); |
34 } | 34 } |
35 | 35 |
36 Future run() { | 36 Future run() { |
37 // Default to `null`, which means all executables. | 37 // Default to `null`, which means all executables. |
38 var executables; | 38 List<String> executables; |
39 if (argResults.wasParsed("executable")) { | 39 if (argResults.wasParsed("executable")) { |
40 if (argResults.wasParsed("no-executables")) { | 40 if (argResults.wasParsed("no-executables")) { |
41 usageException("Cannot pass both --no-executables and --executable."); | 41 usageException("Cannot pass both --no-executables and --executable."); |
42 } | 42 } |
43 | 43 |
44 executables = argResults["executable"]; | 44 executables = argResults["executable"] as List<String>; |
45 } else if (argResults["no-executables"]) { | 45 } else if (argResults["no-executables"]) { |
46 // An empty list means no executables. | 46 // An empty list means no executables. |
47 executables = []; | 47 executables = []; |
48 } | 48 } |
49 | 49 |
50 var overwrite = argResults["overwrite"]; | 50 var overwrite = argResults["overwrite"]; |
51 var args = argResults.rest; | 51 var args = argResults.rest; |
52 | 52 |
53 readArg([String error]) { | 53 readArg([String error]) { |
54 if (args.isEmpty) usageException(error); | 54 if (args.isEmpty) usageException(error); |
(...skipping 37 matching lines...) Loading... |
92 case "path": | 92 case "path": |
93 var path = readArg("No package to activate given."); | 93 var path = readArg("No package to activate given."); |
94 validateNoExtraArgs(); | 94 validateNoExtraArgs(); |
95 return globals.activatePath(path, executables, | 95 return globals.activatePath(path, executables, |
96 overwriteBinStubs: overwrite); | 96 overwriteBinStubs: overwrite); |
97 } | 97 } |
98 | 98 |
99 throw "unreachable"; | 99 throw "unreachable"; |
100 } | 100 } |
101 } | 101 } |
OLD | NEW |