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

Unified Diff: utils/pub/pub.dart

Issue 11472016: Revert "Add logging system to pub and sprinkle some logging in." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
« no previous file with comments | « utils/pub/oauth2.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/pub.dart
diff --git a/utils/pub/pub.dart b/utils/pub/pub.dart
index 625b5df2e0a6b71d74bbb8c3b7a46dc8cbc8dfbc..1daf20d4613c2ffe833b161b393fdf620f8952c8 100644
--- a/utils/pub/pub.dart
+++ b/utils/pub/pub.dart
@@ -18,9 +18,6 @@ import 'command_update.dart';
import 'command_version.dart';
import 'entrypoint.dart';
import 'exit_codes.dart' as exit_codes;
-import 'git_source.dart';
-import 'hosted_source.dart';
-import 'log.dart' as log;
import 'package.dart';
import 'pubspec.dart';
import 'source.dart';
@@ -57,21 +54,10 @@ Map<String, PubCommand> get pubCommands {
ArgParser get pubArgParser {
var parser = new ArgParser();
parser.addFlag('help', abbr: 'h', negatable: false,
- help: 'print this usage information');
+ help: 'Prints this usage information');
parser.addFlag('version', negatable: false,
- help: 'print the version of pub');
- parser.addFlag('trace',
- help: 'print debugging information when an error occurs');
- parser.addOption('verbosity',
- help: 'control output verbosity',
- allowed: ['normal', 'io', 'all'],
- allowedHelp: {
- 'normal': 'errors, warnings, and user messages are shown',
- 'io': 'IO operations are also shown',
- 'all': 'all output including internal tracing messages are shown'
- });
- parser.addFlag('verbose', abbr: 'v', negatable: false,
- help: 'shortcut for "--verbosity=all"');
+ help: 'Prints the version of Pub');
+ parser.addFlag('trace', help: 'Prints a stack trace when an error occurs');
return parser;
}
@@ -80,8 +66,8 @@ main() {
try {
globalOptions = pubArgParser.parse(new Options().arguments);
} on FormatException catch (e) {
- log.error(e.message);
- log.error('Run "pub help" to see available options.');
+ printError(e.message);
+ printError('Run "pub help" to see available options.');
exit(exit_codes.USAGE);
}
@@ -95,24 +81,6 @@ main() {
return;
}
- if (globalOptions['trace']) {
- log.recordTranscript();
- }
-
- switch (globalOptions['verbosity']) {
- case 'normal': log.showNormal(); break;
- case 'io': log.showIO(); break;
- case 'all': log.showAll(); break;
- default:
- // No specific verbosity given, so check for the shortcut.
- if (globalOptions['verbose']) {
- log.showAll();
- } else {
- log.showNormal();
- }
- break;
- }
-
// TODO(nweiz): Have a fallback for this this out automatically once 1145 is
// fixed.
var sdkDir = Platform.environment['DART_SDK'];
@@ -131,8 +99,8 @@ main() {
// Select the command.
var command = pubCommands[globalOptions.rest[0]];
if (command == null) {
- log.error('Could not find a command named "${globalOptions.rest[0]}".');
- log.error('Run "pub help" to see available commands.');
+ printError('Could not find a command named "${globalOptions.rest[0]}".');
+ printError('Run "pub help" to see available commands.');
exit(exit_codes.USAGE);
return;
}
@@ -144,16 +112,16 @@ main() {
/** Displays usage information for the app. */
void printUsage([String description = 'Pub is a package manager for Dart.']) {
- // Build up a buffer so it shows up as a single log entry.
- var buffer = new StringBuffer();
- buffer.add(description);
- buffer.add('\n\n');
- buffer.add('Usage: pub command [arguments]\n\n');
- buffer.add('Global options:\n');
- buffer.add('${pubArgParser.getUsage()}\n\n');
+ print(description);
+ print('');
+ print('Usage: pub command [arguments]');
+ print('');
+ print('Global options:');
+ print(pubArgParser.getUsage());
+ print('');
// Show the commands sorted.
- buffer.add('Available commands:\n');
+ print('Available commands:');
// TODO(rnystrom): A sorted map would be nice.
int length = 0;
@@ -168,17 +136,15 @@ void printUsage([String description = 'Pub is a package manager for Dart.']) {
names.sort((a, b) => a.compareTo(b));
for (var name in names) {
- buffer.add(' ${padRight(name, length)} '
- '${pubCommands[name].description}\n');
+ print(' ${padRight(name, length)} ${pubCommands[name].description}');
}
- buffer.add('\n');
- buffer.add('Use "pub help [command]" for more information about a command.');
- log.message(buffer.toString());
+ print('');
+ print('Use "pub help [command]" for more information about a command.');
}
void printVersion() {
- log.message('Pub $pubVersion');
+ print('Pub $pubVersion');
}
abstract class PubCommand {
@@ -221,8 +187,8 @@ abstract class PubCommand {
try {
commandOptions = commandParser.parse(commandArgs);
} on FormatException catch (e) {
- log.error(e.message);
- log.error('Use "pub help" for more information.');
+ printError(e.message);
+ printError('Use "pub help" for more information.');
exit(exit_codes.USAGE);
}
@@ -237,10 +203,9 @@ abstract class PubCommand {
message = message.substring("Exception: ".length);
}
- log.error(message);
+ printError(message);
if (globalOptions['trace'] && trace != null) {
- log.error(trace);
- log.dumpTranscript();
+ printError(trace);
}
exit(_chooseExitCode(error));
@@ -296,14 +261,14 @@ abstract class PubCommand {
/** Displays usage information for this command. */
void printUsage([String description]) {
if (description == null) description = this.description;
- log.message(description);
- log.message('');
- log.message('Usage: $usage');
+ print(description);
+ print('');
+ print('Usage: $usage');
var commandUsage = commandParser.getUsage();
if (!commandUsage.isEmpty) {
- log.message('');
- log.message(commandUsage);
+ print('');
+ print(commandUsage);
}
}
« no previous file with comments | « utils/pub/oauth2.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698