Skip to content

Commit

Permalink
Allow forcing colour on with --colour, even if STDOUT is not a terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
hoytech committed Mar 24, 2013
1 parent 3be287b commit c1f7c7a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/log-defer-viz
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ my $opt = {
'verbosity' => 30,
'quiet' => 0,
'verbose' => 0,
'colour' => 1,

'timers' => 1,
'timer-columns' => 100,
Expand All @@ -84,9 +83,11 @@ if ($opt->{help}) {

die "Only json input-format is currently supported" unless $opt->{'input-format'} eq 'json';

$opt->{colour} = $opt->{color} if defined $opt->{color};
delete $opt->{colour} if !-t STDOUT;

$opt->{colour} = $opt->{color} if exists $opt->{color};
if (!exists $opt->{colour}) {
$opt->{colour} = 1 if -t STDOUT;
}

if ($opt->{verbose} && $opt->{quiet}) {
die "--verbose and --quiet are incompatible";
} elsif ($opt->{verbose}) {
Expand Down

0 comments on commit c1f7c7a

Please sign in to comment.