| OLD | NEW |
| 1 library pub.command.global_deactivate; | 1 library pub.command.global_deactivate; |
| 2 import 'dart:async'; | 2 import 'dart:async'; |
| 3 import '../command.dart'; | 3 import '../command.dart'; |
| 4 import '../log.dart' as log; | 4 import '../log.dart' as log; |
| 5 import '../utils.dart'; | 5 import '../utils.dart'; |
| 6 class GlobalDeactivateCommand extends PubCommand { | 6 class GlobalDeactivateCommand extends PubCommand { |
| 7 String get description => "Remove a previously activated package."; | 7 String get description => "Remove a previously activated package."; |
| 8 String get usage => "pub global deactivate <package>"; | 8 String get usage => "pub global deactivate <package>"; |
| 9 bool get takesArguments => true; | 9 bool get takesArguments => true; |
| 10 Future onRun() { | 10 Future onRun() { |
| 11 if (commandOptions.rest.isEmpty) { | 11 if (commandOptions.rest.isEmpty) { |
| 12 usageError("No package to deactivate given."); | 12 usageError("No package to deactivate given."); |
| 13 } | 13 } |
| 14 if (commandOptions.rest.length > 1) { | 14 if (commandOptions.rest.length > 1) { |
| 15 var unexpected = commandOptions.rest.skip(1).map((arg) => '"$arg"'); | 15 var unexpected = commandOptions.rest.skip(1).map((arg) => '"$arg"'); |
| 16 var arguments = pluralize("argument", unexpected.length); | 16 var arguments = pluralize("argument", unexpected.length); |
| 17 usageError("Unexpected $arguments ${toSentence(unexpected)}."); | 17 usageError("Unexpected $arguments ${toSentence(unexpected)}."); |
| 18 } | 18 } |
| 19 if (!globals.deactivate(commandOptions.rest.first, logDeactivate: true)) { | 19 if (!globals.deactivate(commandOptions.rest.first)) { |
| 20 dataError("No active package ${log.bold(commandOptions.rest.first)}."); | 20 dataError("No active package ${log.bold(commandOptions.rest.first)}."); |
| 21 } | 21 } |
| 22 return null; | 22 return null; |
| 23 } | 23 } |
| 24 } | 24 } |
| OLD | NEW |