Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: sdk/lib/_internal/pub/lib/src/command_update.dart

Issue 14680005: Add offline support to pub install and update. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..707ac6f6ff9b3dc2bc3ce7a00793e491e6ddb139 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.');
+ }
+
+ 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.");
+ }
+ });
}
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command_lish.dart ('k') | sdk/lib/_internal/pub/lib/src/command_uploader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698