git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] help: colorize man pages

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 21, 2021, 18:01 UTC
Message-ID
<60a7f57fe3301_5503920831@natae.notmuch>
In-Reply-To
<YKdy5jhHgG2who27@coredump.intra.peff.net>
Jeff King wrote:
Show 30 quoted lines
> On Fri, May 21, 2021 at 02:06:48PM +0900, Junio C Hamano wrote:
> 
> > Phillip Wood <phillip.wood123@gmail.com> writes:
> > 
> > > On 20/05/2021 05:07, Felipe Contreras wrote:
> > >> 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,
What do we gain by making `git diff` output 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?
> 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.
> 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.

Sure. In the meantime let's make `git help` output with color just like `git diff`.

Cheers.
(and good luck convincing a GNU project of anything)
-- 
Felipe Contreras
Previous: Jeff KingNext: Jeff King
Message 10 of 18 in “help: colorize man pages”
  1. help: colorize man pagesFelipe Contreras, May 20, 2021
  2. Phillip WoodMay 20, 2021
  3. Felipe ContrerasMay 20, 2021
  4. Phillip WoodMay 20, 2021
  5. Felipe ContrerasMay 20, 2021
  6. Phillip WoodMay 20, 2021
  7. Felipe ContrerasMay 21, 2021
  8. Junio C HamanoMay 21, 2021
  9. Jeff KingMay 21, 2021
  10. Felipe ContrerasMay 21, 2021
  11. Jeff KingMay 21, 2021
  12. Felipe ContrerasMay 21, 2021
  13. Jeff KingMay 22, 2021
  14. Philip OakleyMay 22, 2021
  15. Felipe ContrerasMay 22, 2021
  16. Felipe ContrerasMay 22, 2021
  17. Felipe ContrerasMay 21, 2021
  18. Leah NeukirchenMay 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.