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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart

Issue 365993007: Support "pub downgrade". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.global_deactivate; 5 library pub.command.global_deactivate;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../command.dart'; 9 import '../command.dart';
10 import '../utils.dart'; 10 import '../utils.dart';
11 import '../version.dart';
12 11
13 /// Handles the `global deactivate` pub command. 12 /// Handles the `global deactivate` pub command.
14 class GlobalDeactivateCommand extends PubCommand { 13 class GlobalDeactivateCommand extends PubCommand {
15 String get description => "Remove a previously activated package."; 14 String get description => "Remove a previously activated package.";
16 String get usage => "pub global deactivate <package>"; 15 String get usage => "pub global deactivate <package>";
17 bool get requiresEntrypoint => false; 16 bool get requiresEntrypoint => false;
18 bool get takesArguments => true; 17 bool get takesArguments => true;
19 18
20 Future onRun() { 19 Future onRun() {
21 // Make sure there is a package. 20 // Make sure there is a package.
22 if (commandOptions.rest.isEmpty) { 21 if (commandOptions.rest.isEmpty) {
23 usageError("No package to deactivate given."); 22 usageError("No package to deactivate given.");
24 } 23 }
25 24
26 // Don't allow extra arguments. 25 // Don't allow extra arguments.
27 if (commandOptions.rest.length > 1) { 26 if (commandOptions.rest.length > 1) {
28 var unexpected = commandOptions.rest.skip(1).map((arg) => '"$arg"'); 27 var unexpected = commandOptions.rest.skip(1).map((arg) => '"$arg"');
29 var arguments = pluralize("argument", unexpected.length); 28 var arguments = pluralize("argument", unexpected.length);
30 usageError("Unexpected $arguments ${toSentence(unexpected)}."); 29 usageError("Unexpected $arguments ${toSentence(unexpected)}.");
31 } 30 }
32 31
33 globals.deactivate(commandOptions.rest.first); 32 globals.deactivate(commandOptions.rest.first);
33 return null;
34 } 34 }
35 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698