]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiViewText.pm
lei (lcat|q): support --no-color and --color
[public-inbox.git] / lib / PublicInbox / LeiViewText.pm
index e0d62c0d2ab7de7e1ac53466b42e37d4bd21ff9e..d0f8b7f43aa1cc3cc9896183767a422ca7a479ec 100644 (file)
@@ -69,7 +69,7 @@ sub uncolored { ${$_[0]->{obuf}} .= $_[2] }
 sub new {
        my ($cls, $lei) = @_;
        my $self = bless { %{$lei->{opt}}, -colored => \&uncolored }, $cls;
-       return $self unless $self->{color} || -t $lei->{1};
+       return $self unless $self->{color} //= -t $lei->{1};
        my $cmd = [ qw(git config -z --includes -l) ];
        my ($r, $pid) = popen_rd($cmd, undef, { 2 => $lei->{2} });
        my $cfg = PublicInbox::Config::config_fh_parse($r, "\0", "\n");