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

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

Issue 184113007: Support JSON output for pub build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Re-upload. Created 6 years, 10 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 69076460b64be7ac7662baac7fed97f868f83c74..7b97c07f410f4bfa9694503c2cd08d2a0d3c3d9f 100644
--- a/sdk/lib/_internal/pub/lib/src/command.dart
+++ b/sdk/lib/_internal/pub/lib/src/command.dart
@@ -47,6 +47,7 @@ abstract class PubCommand {
buffer.writeln();
buffer.writeln('Global options:');
buffer.writeln(pubArgParser.getUsage());
+ buffer.writeln();
buffer.write(_listCommands(mainCommands));
buffer.writeln();
buffer.writeln(
@@ -59,7 +60,7 @@ abstract class PubCommand {
/// [commands].
static void usageErrorWithCommands(Map<String, PubCommand> commands,
String message) {
- throw new UsageException("$message\n${_listCommands(commands)}");
+ throw new UsageException(message, _listCommands(commands));
}
/// Writes [commands] in a nicely formatted list to [buffer].
@@ -81,7 +82,6 @@ abstract class PubCommand {
var isSubcommand = commands != mainCommands;
var buffer = new StringBuffer();
- buffer.writeln();
buffer.writeln('Available ${isSubcommand ? "sub" : ""}commands:');
for (var name in names) {
buffer.writeln(' ${padRight(name, length)} '
@@ -193,7 +193,13 @@ abstract class PubCommand {
/// Throw an [ApplicationException] for a usage error of this command with
/// [message].
void usageError(String message) {
- throw new UsageException("$message\n\n${_getUsage()}");
+ throw new UsageException(message, _getUsage());
+ }
+
+ /// Throw an [ApplicationException] for a data error of this command with
nweiz 2014/03/05 02:36:52 I don't understand what a "data error of this comm
Bob Nystrom 2014/03/07 00:42:18 Reworded.
+ /// [message].
+ void dataError(String message) {
+ throw new DataException(message);
}
/// Generates a string of usage information for this command.
@@ -203,8 +209,8 @@ abstract class PubCommand {
var commandUsage = commandParser.getUsage();
if (!commandUsage.isEmpty) {
- buffer.write('\n');
- buffer.write(commandUsage);
+ buffer.writeln();
+ buffer.writeln(commandUsage);
}
if (subcommands.isNotEmpty) {

Powered by Google App Engine
This is Rietveld 408576698