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 {
Future<int> _exit(int code) async {
if (flutterUsage.isFirstRun)
flutterUsage.printUsage();
flutterUsage.printWelcome();
// Send any last analytics calls that are in progress without overly delaying
// the tool's exit (we wait a maximum of 250ms).
......
......@@ -277,14 +277,22 @@ class AnsiTerminal {
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';
set singleCharMode(bool value) {
// TODO(goderbauer): instead of trying to set lineMode and then catching [_ENOTTY] or [_INVALID_HANDLE],
// we should check beforehand if stdin is connected to a terminal or not
// (requires https://github.com/dart-lang/sdk/issues/29083 to be resolved).
// TODO(goderbauer): instead of trying to set lineMode and then catching
// [_ENOTTY] or [_INVALID_HANDLE], we should check beforehand if stdin is
// connected to a terminal or not.
// (Requires https://github.com/dart-lang/sdk/issues/29083 to be resolved.)
try {
// The order of setting lineMode and echoMode is important on Windows.
if (value) {
......
......@@ -116,7 +116,7 @@ abstract class FlutterCommand extends Command<Null> {
final UsageTimer analyticsTimer = usagePath == null ? null : flutterUsage.startTimer(name);
if (flutterUsage.isFirstRun)
flutterUsage.printUsage();
flutterUsage.printWelcome();
return verifyThenRunCommand().whenComplete(() {
final int ms = stopwatch.elapsedMilliseconds;
......
......@@ -47,7 +47,7 @@ class Usage {
Analytics _analytics;
bool _printedUsage = false;
bool _printedWelcome = false;
bool _suppressAnalytics = false;
bool get isFirstRun => _analytics.firstRun;
......@@ -108,10 +108,12 @@ class Usage {
await _analytics.waitForLastPing(timeout: const Duration(milliseconds: 250));
}
void printUsage() {
if (_printedUsage)
void printWelcome() {
// 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;
_printedUsage = true;
_printedWelcome = true;
printStatus('');
printStatus('''
......
......@@ -218,7 +218,7 @@ class MockUsage implements Usage {
Future<Null> ensureAnalyticsSent() => new Future<Null>.value();
@override
void printUsage() { }
void printWelcome() { }
}
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