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

Side by Side Diff: pkg/analyzer_cli/lib/src/ansi.dart

Issue 2775633002: Use ansi color in the dartanalyzer cli output. (Closed)
Patch Set: make tests more robust Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6
7 /// Public for testing.
8 bool runningTests = false;
9
10 bool terminalSupportsAnsi() {
11 return !runningTests &&
12 !Platform.isWindows &&
13 stdioType(stdout) == StdioType.TERMINAL;
14 }
15
16 class AnsiLogger {
17 final bool useAnsi;
18
19 String get cyan => _code('\u001b[36m');
20 String get green => _code('\u001b[32m');
21 String get magenta => _code('\u001b[35m');
22 String get red => _code('\u001b[31m');
23 String get yellow => _code('\u001b[33m');
24 String get blue => _code('\u001b[34m');
25 String get gray => _code('\u001b[1;30m');
26 String get none => _code('\u001b[0m');
27 String get noColor => _code('\u001b[39m');
28 String get bold => _code('\u001b[1m');
29
30 AnsiLogger(this.useAnsi);
31
32 String get bullet => (runningTests || !Platform.isWindows) ? '•' : '-';
33
34 String _code(String ansiCode) => useAnsi ? ansiCode : '';
35 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer_cli/lib/src/error_formatter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698