git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Leah Neukirchen" <leah@vuxu.org>,
	"Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [PATCH v4] help: colorize man pages
Date: Fri, 21 May 2021 16:26:04 -0400	[thread overview]
Message-ID: <YKgXXCvWYI9rjKJT@coredump.intra.peff.net> (raw)
In-Reply-To: <60a7f57fe3301_5503920831@natae.notmuch>

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

  reply	other threads:[~2021-05-21 20:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  4:07 [PATCH v4] help: colorize man pages Felipe Contreras
2021-05-20  9:26 ` Phillip Wood
2021-05-20 13:58   ` Felipe Contreras
2021-05-20 15:13     ` Phillip Wood
2021-05-20 15:59       ` Felipe Contreras
2021-05-20 18:00         ` Phillip Wood
2021-05-21 17:43           ` Felipe Contreras
2021-05-21  5:06   ` Junio C Hamano
2021-05-21  8:44     ` Jeff King
2021-05-21 18:01       ` Felipe Contreras
2021-05-21 20:26         ` Jeff King [this message]
2021-05-21 21:40           ` Felipe Contreras
2021-05-22  9:55             ` Jeff King
2021-05-22 12:43               ` Philip Oakley
2021-05-22 20:53                 ` Felipe Contreras
2021-05-22 20:49               ` Felipe Contreras
2021-05-21 17:54     ` Felipe Contreras
2021-05-20 14:39 ` Leah Neukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKgXXCvWYI9rjKJT@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=leah@vuxu.org \
    --cc=phillip.wood123@gmail.com \
    --cc=rsbecker@nexbridge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).