Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: view onto command pipeline?

On Wed, Jul 20, 2022, at 3:27 PM, Phil Pennock wrote:
>     function git { command git -c color.ui=auto "$@" }

Maybe you missed the clever bit that Bart helped with?  As far as I know, these
'auto' settings can only detect a tty, they can't detect a pipe that happens to feed a tty.
Hence the panoply of command-line options and environment variables that Unix color needs.

I had been wondering about OS support to create a more standard mechanism, but it seems
impossible?   A fcntl(F_TTY) flag bit that can be set on a pipe to hint that it should be
treated like a tty would seem like a start, but maybe nothing short of an end-to-end handshake negotiation along the pipeline is going to work, and then maybe that's not Unix any more.

Obviously yes git has an automatic pager option,  probably as another workaround for this, but personally I just want to type '| less',  invariant to whether I'm running git diff or plain diff.   For the same reason agree the -t 1 test might be redundant for the default git config, but not
for all other commands or scenarios.

Messages sorted by: Reverse Date, Date, Thread, Author