Commit 57b34227 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Bold each line individually (#9069)

This should make the message in Travis logs look better.
parent ae899486
...@@ -294,7 +294,7 @@ Future<String> _doctorText() async { ...@@ -294,7 +294,7 @@ Future<String> _doctorText() async {
Future<int> _exit(int code) async { Future<int> _exit(int code) async {
if (flutterUsage.isFirstRun) if (flutterUsage.isFirstRun)
flutterUsage.printUsage(); flutterUsage.printWelcome();
// Send any last analytics calls that are in progress without overly delaying // Send any last analytics calls that are in progress without overly delaying
// the tool's exit (we wait a maximum of 250ms). // the tool's exit (we wait a maximum of 250ms).
......
...@@ -277,14 +277,22 @@ class AnsiTerminal { ...@@ -277,14 +277,22 @@ class AnsiTerminal {
bool supportsColor; bool supportsColor;
String bolden(String str) => supportsColor ? '$_bold$str$_reset' : str; String bolden(String message) {
if (!supportsColor)
return message;
final StringBuffer result = new StringBuffer();
for (String line in message.split('\n'))
result.writeln('$_bold$line$_reset');
return result.toString();
}
String clearScreen() => supportsColor ? _clear : '\n\n'; String clearScreen() => supportsColor ? _clear : '\n\n';
set singleCharMode(bool value) { set singleCharMode(bool value) {
// TODO(goderbauer): instead of trying to set lineMode and then catching [_ENOTTY] or [_INVALID_HANDLE], // TODO(goderbauer): instead of trying to set lineMode and then catching
// we should check beforehand if stdin is connected to a terminal or not // [_ENOTTY] or [_INVALID_HANDLE], we should check beforehand if stdin is
// (requires https://github.com/dart-lang/sdk/issues/29083 to be resolved). // connected to a terminal or not.
// (Requires https://github.com/dart-lang/sdk/issues/29083 to be resolved.)
try { try {
// The order of setting lineMode and echoMode is important on Windows. // The order of setting lineMode and echoMode is important on Windows.
if (value) { if (value) {
......
...@@ -116,7 +116,7 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -116,7 +116,7 @@ abstract class FlutterCommand extends Command<Null> {
final UsageTimer analyticsTimer = usagePath == null ? null : flutterUsage.startTimer(name); final UsageTimer analyticsTimer = usagePath == null ? null : flutterUsage.startTimer(name);
if (flutterUsage.isFirstRun) if (flutterUsage.isFirstRun)
flutterUsage.printUsage(); flutterUsage.printWelcome();
return verifyThenRunCommand().whenComplete(() { return verifyThenRunCommand().whenComplete(() {
final int ms = stopwatch.elapsedMilliseconds; final int ms = stopwatch.elapsedMilliseconds;
......
...@@ -47,7 +47,7 @@ class Usage { ...@@ -47,7 +47,7 @@ class Usage {
Analytics _analytics; Analytics _analytics;
bool _printedUsage = false; bool _printedWelcome = false;
bool _suppressAnalytics = false; bool _suppressAnalytics = false;
bool get isFirstRun => _analytics.firstRun; bool get isFirstRun => _analytics.firstRun;
...@@ -108,10 +108,12 @@ class Usage { ...@@ -108,10 +108,12 @@ class Usage {
await _analytics.waitForLastPing(timeout: const Duration(milliseconds: 250)); await _analytics.waitForLastPing(timeout: const Duration(milliseconds: 250));
} }
void printUsage() { void printWelcome() {
if (_printedUsage) // This gets called if it's the first run by the selected command, if any,
// and on exit, in case there was no command.
if (_printedWelcome)
return; return;
_printedUsage = true; _printedWelcome = true;
printStatus(''); printStatus('');
printStatus(''' printStatus('''
......
...@@ -218,7 +218,7 @@ class MockUsage implements Usage { ...@@ -218,7 +218,7 @@ class MockUsage implements Usage {
Future<Null> ensureAnalyticsSent() => new Future<Null>.value(); Future<Null> ensureAnalyticsSent() => new Future<Null>.value();
@override @override
void printUsage() { } void printWelcome() { }
} }
class _MockUsageTimer implements UsageTimer { class _MockUsageTimer implements UsageTimer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment