Chromium Code Reviews| Index: sdk/lib/_internal/pub/lib/src/command_update.dart |
| diff --git a/sdk/lib/_internal/pub/lib/src/command_update.dart b/sdk/lib/_internal/pub/lib/src/command_update.dart |
| index 147e92582123761497eded42ac6a22cbe49b61e4..ab3428b5a714e9475f881cf83b3e5f9259e61af7 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/command_update.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/command_update.dart |
| @@ -6,6 +6,8 @@ library command_update; |
| import 'dart:async'; |
| +import 'package:args/args.dart'; |
| + |
| import 'command.dart'; |
| import 'entrypoint.dart'; |
| import 'log.dart' as log; |
| @@ -17,6 +19,14 @@ class UpdateCommand extends PubCommand { |
| String get usage => 'pub update [dependencies...]'; |
| + ArgParser get commandParser { |
| + return new ArgParser() |
| + ..addFlag('offline', |
| + help: 'Use cached packages instead of accessing the network'); |
|
nweiz
2013/05/06 23:02:25
Trailing period.
Bob Nystrom
2013/05/07 21:03:09
Ditto.
|
| + } |
| + |
| + bool get isOffline => commandOptions['offline']; |
| + |
| Future onRun() { |
| var future; |
| if (commandOptions.rest.isEmpty) { |
| @@ -24,7 +34,13 @@ class UpdateCommand extends PubCommand { |
| } else { |
| future = entrypoint.updateDependencies(commandOptions.rest); |
| } |
| - return future |
| - .then((_) => log.message("Dependencies updated!")); |
| + |
| + return future.then((_) { |
| + log.message("Dependencies updated!"); |
| + if (isOffline) { |
| + log.warning("Warning: Updating when offline may not update you to the " |
| + "latest versions of your dependencies."); |
| + } |
| + }); |
| } |
| } |