Re: [PATCH v4] help: colorize man pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 21, 2021 at 01:01:35PM -0500, Felipe Contreras wrote:

> > I still don't understand what we gain by making this a Git feature,
> 
> What do we gain by making `git diff` output color?

Huh? Git is outputting the diff. Who else would output the color?

> > Why would we do that versus saying: if you want to change the colors in
> > the tool that Git calls, then configure the tool?
> 
> Once again... How?

By exporting the environment variables that ask it to do so, just like
you showed already?

> > If you like to see colors in manpages, why not configure "man" (either
> > by setting these environment variables all the time, or by triggering
> > them in MANPAGER)?
> 
> Let me try that...
> 
>   MANPAGER="less -Dd+r -Du+b -Ds+m" git help git
> 
> It doesn't work.

  ESC=$(printf '\33')
  export MANCOLORS="LESS_TERMCAP_md=$ESC[31m LESS_TERMCAP_me=$ESC[0m"
  export MANPAGER='sh -c "eval $MANCOLORS less"'
  man ls
  git help git

At least on Linux, $MANPAGER is some weird limbo that is not run with
the shell, but not just a simple command. Hence the extra layer of "sh".

If I were actually planning to use this myself, I'd probably put it in a
"manpager" script in my $PATH and just do MANPAGER=manpager.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux