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

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

Issue 805393002: Update pub to use the new command runner API in args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 11 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/global_deactivate.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart b/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart
index 4e966552940d72653e9cd76fcaf670a67b50d1e4..595f6ffd798bed2bab598dbb93d6622ff822e359 100644
--- a/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart
@@ -12,27 +12,25 @@ import '../utils.dart';
/// Handles the `global deactivate` pub command.
class GlobalDeactivateCommand extends PubCommand {
+ String get name => "deactivate";
String get description => "Remove a previously activated package.";
- String get usage => "pub global deactivate <package>";
- bool get takesArguments => true;
+ String get invocation => "pub global deactivate <package>";
- Future onRun() {
+ void run() {
// Make sure there is a package.
- if (commandOptions.rest.isEmpty) {
- usageError("No package to deactivate given.");
+ if (argResults.rest.isEmpty) {
+ usageException("No package to deactivate given.");
}
// Don't allow extra arguments.
- if (commandOptions.rest.length > 1) {
- var unexpected = commandOptions.rest.skip(1).map((arg) => '"$arg"');
+ if (argResults.rest.length > 1) {
+ var unexpected = argResults.rest.skip(1).map((arg) => '"$arg"');
var arguments = pluralize("argument", unexpected.length);
- usageError("Unexpected $arguments ${toSentence(unexpected)}.");
+ usageException("Unexpected $arguments ${toSentence(unexpected)}.");
}
- if (!globals.deactivate(commandOptions.rest.first)) {
- dataError("No active package ${log.bold(commandOptions.rest.first)}.");
+ if (!globals.deactivate(argResults.rest.first)) {
+ dataError("No active package ${log.bold(argResults.rest.first)}.");
}
-
- return null;
}
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/global_activate.dart ('k') | sdk/lib/_internal/pub/lib/src/command/global_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698