OLD | NEW |
1 library pub.command.cache_add; | 1 library pub.command.cache_add; |
2 import 'dart:async'; | 2 import 'dart:async'; |
| 3 import 'package:pub_semver/pub_semver.dart'; |
3 import '../command.dart'; | 4 import '../command.dart'; |
4 import '../log.dart' as log; | 5 import '../log.dart' as log; |
5 import '../package.dart'; | 6 import '../package.dart'; |
6 import '../utils.dart'; | 7 import '../utils.dart'; |
7 import '../version.dart'; | |
8 class CacheAddCommand extends PubCommand { | 8 class CacheAddCommand extends PubCommand { |
9 String get description => "Install a package."; | 9 String get description => "Install a package."; |
10 String get usage => | 10 String get usage => |
11 "pub cache add <package> [--version <constraint>] [--all]"; | 11 "pub cache add <package> [--version <constraint>] [--all]"; |
12 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html"; | 12 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html"; |
13 bool get takesArguments => true; | 13 bool get takesArguments => true; |
14 CacheAddCommand() { | 14 CacheAddCommand() { |
15 commandParser.addFlag( | 15 commandParser.addFlag( |
16 "all", | 16 "all", |
17 help: "Install all matching versions.", | 17 help: "Install all matching versions.", |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (commandOptions["all"]) { | 55 if (commandOptions["all"]) { |
56 versions.sort(); | 56 versions.sort(); |
57 return Future.forEach(versions, downloadVersion); | 57 return Future.forEach(versions, downloadVersion); |
58 } else { | 58 } else { |
59 versions.sort(Version.prioritize); | 59 versions.sort(Version.prioritize); |
60 return downloadVersion(versions.last); | 60 return downloadVersion(versions.last); |
61 } | 61 } |
62 }); | 62 }); |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |