OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 '../command.dart'; | 7 import '../command.dart'; |
8 import '../solver/version_solver.dart'; | 8 import '../solver/version_solver.dart'; |
9 | 9 |
10 /// Handles the `get` pub command. | 10 /// Handles the `get` pub command. |
11 class GetCommand extends PubCommand { | 11 class GetCommand extends PubCommand { |
12 String get name => "get"; | 12 String get name => "get"; |
13 String get description => "Get the current package's dependencies."; | 13 String get description => "Get the current package's dependencies."; |
14 String get invocation => "pub get"; | 14 String get invocation => "pub get"; |
15 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-get.html"; | 15 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-get.html"; |
16 List<String> get aliases => const ["install"]; | 16 List<String> get aliases => const ["install"]; |
17 bool get isOffline => argResults["offline"]; | 17 bool get isOffline => argResults["offline"]; |
18 | 18 |
19 GetCommand() { | 19 GetCommand() { |
20 argParser.addFlag('offline', | 20 argParser.addFlag('offline', |
21 help: 'Use cached packages instead of accessing the network.'); | 21 help: 'Use cached packages instead of accessing the network.'); |
22 | 22 |
23 argParser.addFlag('dry-run', abbr: 'n', negatable: false, | 23 argParser.addFlag('dry-run', abbr: 'n', negatable: false, |
24 help: "Report what dependencies would change but don't change any."); | 24 help: "Report what dependencies would change but don't change any."); |
25 | 25 |
26 argParser.addFlag('precompile', defaultsTo: true, | 26 argParser.addFlag('precompile', defaultsTo: true, |
27 help: "Precompile executables and transformed dependencies."); | 27 help: "Precompile executables and transformed dependencies."); |
28 | 28 |
29 argParser.addFlag('packages-dir', | 29 argParser.addFlag('packages-dir', |
30 negatable: true, defaultsTo: true, | 30 negatable: true, |
31 help: "Generate a packages/ directory when installing packages."); | 31 help: "Generate a packages/ directory when installing packages."); |
32 } | 32 } |
33 | 33 |
34 Future run() { | 34 Future run() { |
35 return entrypoint.acquireDependencies(SolveType.GET, | 35 return entrypoint.acquireDependencies(SolveType.GET, |
36 dryRun: argResults['dry-run'], | 36 dryRun: argResults['dry-run'], |
37 precompile: argResults['precompile'], | 37 precompile: argResults['precompile'], |
38 packagesDir: argResults['packages-dir']); | 38 packagesDir: argResults['packages-dir']); |
39 } | 39 } |
40 } | 40 } |
OLD | NEW |