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

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

Issue 354763006: Add a "pub global run" command. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart
index ccd54d0ea3d66c24aa87c4f618087b6223f0adf0..daa1a6b23a0be52989c2f1b239c77dfdff19c20a 100644
--- a/sdk/lib/_internal/pub/lib/src/command.dart
+++ b/sdk/lib/_internal/pub/lib/src/command.dart
@@ -191,7 +191,10 @@ abstract class PubCommand {
entrypoint = new Entrypoint(path.current, cache);
}
- return syncFuture(onRun);
+ return syncFuture(onRun).catchError((error) {
+ if (error is UsageException) error.bindUsage(_getUsage());
+ throw error;
+ });
}
/// Override this to perform the specific command.
@@ -214,13 +217,6 @@ abstract class PubCommand {
log.message('$description\n\n${_getUsage()}');
}
- // TODO(rnystrom): Use this in other places handle usage failures.
- /// Throw a [UsageException] for a usage error of this command with
- /// [message].
- void usageError(String message) {
- throw new UsageException(message, _getUsage());
- }
-
/// Parses a user-supplied integer [intString] named [name].
///
/// If the parsing fails, prints a usage message and exits.

Powered by Google App Engine
This is Rietveld 408576698