Add a --color flag.

This commit is contained in:
Natalie Weizenbaum 2016-09-24 18:26:05 -07:00 committed by Natalie Weizenbaum
parent e07ae949a1
commit a6d2f3b035

View File

@ -21,6 +21,10 @@ void main(List<String> args) {
help: 'Output style.',
allowed: ['expanded'],
defaultsTo: 'expanded')
..addFlag('color',
abbr: 'c',
help: 'Whether to emit terminal colors.',
defaultsTo: stdout.hasTerminal && !Platform.isWindows)
..addFlag('trace', help: 'Print full Dart stack traces for exceptions.')
..addFlag('help',
abbr: 'h', help: 'Print this usage information.', negatable: false);
@ -44,7 +48,7 @@ void main(List<String> args) {
var css = toCss(cssTree);
if (css.isNotEmpty) print(css);
} on SassException catch (error, stackTrace) {
stderr.writeln(error.toString(color: true));
stderr.writeln(error.toString(color: options['color']));
if (options['trace']) {
stderr.writeln();