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 library pub.command.get; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import '../command.dart'; | 7 import '../command.dart'; |
10 import '../solver/version_solver.dart'; | 8 import '../solver/version_solver.dart'; |
11 | 9 |
12 /// Handles the `get` pub command. | 10 /// Handles the `get` pub command. |
13 class GetCommand extends PubCommand { | 11 class GetCommand extends PubCommand { |
14 String get name => "get"; | 12 String get name => "get"; |
15 String get description => "Get the current package's dependencies."; | 13 String get description => "Get the current package's dependencies."; |
16 String get invocation => "pub get"; | 14 String get invocation => "pub get"; |
17 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"; |
18 List<String> get aliases => const ["install"]; | 16 List<String> get aliases => const ["install"]; |
19 bool get isOffline => argResults["offline"]; | 17 bool get isOffline => argResults["offline"]; |
20 | 18 |
21 GetCommand() { | 19 GetCommand() { |
22 argParser.addFlag('offline', | 20 argParser.addFlag('offline', |
23 help: 'Use cached packages instead of accessing the network.'); | 21 help: 'Use cached packages instead of accessing the network.'); |
24 | 22 |
25 argParser.addFlag('dry-run', abbr: 'n', negatable: false, | 23 argParser.addFlag('dry-run', abbr: 'n', negatable: false, |
26 help: "Report what dependencies would change but don't change any."); | 24 help: "Report what dependencies would change but don't change any."); |
27 } | 25 } |
28 | 26 |
29 Future run() { | 27 Future run() { |
30 return entrypoint.acquireDependencies(SolveType.GET, | 28 return entrypoint.acquireDependencies(SolveType.GET, |
31 dryRun: argResults['dry-run']); | 29 dryRun: argResults['dry-run']); |
32 } | 30 } |
33 } | 31 } |
OLD | NEW |