On Fri, May 21, 2021 at 02:06:48PM +0900, Junio C Hamano wrote:
Phillip Wood [off-list ref] writes:
quoted
On 20/05/2021 05:07, Felipe Contreras wrote:
quoted
We already colorize tools traditionally not colorized by default, like
diff and grep. Let's do the same for man.
I think there is a distinction between 'diff' and 'grep' where we are
generating the content and help where we are running man - I would
expect a man page to look the same whether it is displayed by 'man git
foo' or 'git help foo'
... as long as the user chooses "man" backend, that is. And I tend
to agree, but that is our expectation.
If we added this new mode of driving the same "man" but with
different environment variables exported to tweak how "less"
behaves, and taught it to builtin/help.c::exec_viewer() and
builtin/help.c::man_viewer_list, that might become more palatable in
the sense that we can view it as feeding the same manual page to
this another "man" that behaves differently from the plain "man",
just like we can feed it to "woman" or "konqueror" to get a different
view. So those (like you and I) who expect a man page to look the
same in "man git foo" and "git help -m foo" can keep using our current
configuration, while those who want yet another variant of "man" output
in addition to the current "man", "woman", and "konqueror" can choose
it and get "colorized" output.
I still don't understand what we gain by making this a Git feature, as
all of the changed behavior is totally within the program we are
calling. Imagine that konqueror (or an html viewer like firefox) had an
option to set its color scheme from the command line. Should we
introduce a new baked-in fancy-konqueror backend that is "run the tool
with a tweaked color scheme"?
Why would we do that versus saying: if you want to change the colors in
the tool that Git calls, then configure the tool?
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)? And then Git doesn't have to care either way; it is
calling "man" which does what the user wants, colors or no. If you
really for some reason only want colorized man pages when called via
"git help", then why not set man.fancy.cmd to invoke your preferred
config?
If those configurations are awkward to trigger via man (e.g., putting
escapes into termcap variables), isn't that something that could be
improved in man? And then it would benefit everyone who uses man, not
just Git.
-Peff