git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [PATCH v2] help: colorize man pages
Date: Tue, 18 May 2021 15:53:38 -0500	[thread overview]
Message-ID: <60a429526d3f7_2c1020870@natae.notmuch> (raw)
In-Reply-To: <xmqqa6os2j05.fsf@gitster.g>

Junio C Hamano wrote:
> This seems very specific to use of "less" and hopefully does not do
> anything (bad) when a different pager is used by "man".
> 
>  - Would it help readers to somehow tell that color.man does not
>    apply at all to those whose "man" does not "less" in the
>    documentation?

Indeed it would. Done.

>  - What does it mean to set this variable to "always"?  For commands
>    that we control how the various pieces of output are colored (or
>    not), e.g.
> 
>    $ git -c color.ui=always log -1 -p >git-log-output.txt
> 
>    it is obvious what "always" means, but given the implementation
>    that tweaks how "less" should behave, a similar command (below)
>    would not colorize its output like the "git log" example above
>    does, would it?
> 
>    $ git -c color.man=always help -m git >git-help-text.txt
> 
> I am just wondering if we are better off not to mention "always" in
> the documentation patch above.  It seems more like that the
> configuration variable is to answer this question and nothing else:
> 
>     when 'git help' shows manual pages and internally uses 'less' as
>     its pager, do we tell it to colorize the output?
> 
> for which sensible answers are 'true' or 'false'.  For that matter,
> it is not clear what "auto" ought to mean, either.

True. The user most likely is not going to run 'git help $x > output'.

Initially I was making color.man a boolean, but stopped when I found
color.pager. Since Jeff said to use want_color() in the same way all the
other color.* configurations, I forgot, and used a colorbool.

I've returned back to a bool, and updated the documentation.

color.ui=auto is still respected (if stdout is a tty color is disabled),
but it doesn't really matter because less seems to be smart and disable
color anyway.

v3 sent.

Cheers.

-- 
Felipe Contreras

      reply	other threads:[~2021-05-18 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 13:20 [PATCH v2] help: colorize man pages Felipe Contreras
2021-05-18 14:50 ` Junio C Hamano
2021-05-18 20:53   ` Felipe Contreras [this message]

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=60a429526d3f7_2c1020870@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --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).