On Thu, Oct 6, 2022 at 6:55 PM Knut Olav Bøhmer <[email protected]> wrote: > > On Thu, Oct 6, 2022 at 5:44 PM Tobias Girstmair <[email protected]> wrote: > > > > On Thu, Oct 06, 2022 at 04:44:58PM +0200, Knut Olav Břhmer wrote: > > >Hi, > > > > > >I would like to enable output without color. > > >I also have on the wish list to print passfile_dir with a leading slash. > > > > i'm assuming you need this for passing pass' output to another program. > > > > how about using something like the code below. 'test -t' checks whether > > a file descriptor is a tty. this would keep interactive output the same, > > while automatically making pipelines work. > > > > if [[ -t 1 ]] > > then > > color=always > > else > > color=never > > fi > > > > # ... > > > > grepresults=$(... | grep --color="$color" ...) > > > > > > if that's too verbose for you: > > > > color=never > > test -t 1 && color=always > > consider this > > pass grep .| less -R > > Sometimes want colored output even if the output is a pipe. But I > would still consider your idea an improvement.
test -t should be used if --color=auto -- Knut Olav Bøhmer 41 000 108
