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

Re: [PATCH v7] help: colorize man pages if man.color=true under less(1)

From
Jeff King <peff@peff.net>
Date
Jun 23, 2021, 23:58 UTC
Message-ID
<YNPKwIuZvpyWSNXH@coredump.intra.peff.net>
In-Reply-To
<87mtrj2faq.fsf@evledraar.gmail.com>
On Mon, Jun 21, 2021 at 09:08:20PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 24 quoted lines
> > [snip] I think it would be easier to understand to end-users
> > if this were exposed as a new "mode", like "git help --web" and "git
> > help --info" are different modes from the "git help --man",
> > something like "git help --fancy-man" (or whatever is easy to type
> > and explain, and also add it to the variants help.format knows about
> > to make it easy to set the default).
> >
> > One advantage of doing so is that we do not have to worry about "ah,
> > user has LESS_BLAH environment variable so we should disable this
> > new mode here" etc.  As long as the new mode is requested either via
> > the command line option or help.format configuration, it can
> > completely take it over.  That simplifies the necessary explanation
> > given to the users quite a lot, no?
> 
> The interaction between "git help" and "man"/"less" doesn't really have
> an equivalent in the rest of git as far as color output goes. Usually we
> emit colors via our own programs.
> 
> But no, I think it makes the most sense to consider this orthagonal to
> help.format=man or man.viewer=<cmd>.
> 
> We're not invoking a different man viewer or command, we're just
> expecting that mode to invoke the pager, and if that pager is less to
> have these variables tweak our color preferences.

FWIW, if we are going to do this, then just having it as "color.man" makes the most sense to me. It is easily explained as "when we invoke man, set up some environment variables that may enable colors in the output".

I'm still entirely unconvinced that this should be in Git at all; pointing GIT_MAN_VIEWER or man.*.cmd at a color-man wrapper seems like it would be sufficient. But it feels like that conversation was not going anywhere productive; I mention it here only to indicate that my response above is not an endorsement of the concept.

-Peff
Previous: Ævar Arnfjörð BjarmasonNext: Felipe Contreras
Message 12 of 22 in “help: colorize man pages”
  1. help: colorize man pagesFelipe Contreras, May 23, 2021
  2. Phillip WoodMay 24, 2021
  3. Felipe ContrerasMay 24, 2021
  4. Ævar Arnfjörð BjarmasonJun 8, 2021
  5. Junio C HamanoJun 8, 2021
  6. Felipe ContrerasJun 8, 2021
  7. help: colorize man pages if man.color=true under less(1)Ævar Arnfjörð Bjarmason, Jun 21, 2021
  8. Phillip WoodJun 21, 2021
  9. Junio C HamanoJun 21, 2021
  10. Felipe ContrerasJun 21, 2021
  11. Ævar Arnfjörð BjarmasonJun 21, 2021
  12. Jeff KingJun 23, 2021
  13. Felipe ContrerasJun 24, 2021
  14. Junio C HamanoJun 28, 2021
  15. Felipe ContrerasJun 28, 2021
  16. Felipe ContrerasJun 21, 2021
  17. Jeff KingJun 24, 2021
  18. Junio C HamanoJun 29, 2021
  19. Felipe ContrerasJun 29, 2021
  20. Felipe ContrerasJun 24, 2021
  21. help: add option to colorize man pages under lessFelipe Contreras, Jun 26, 2021
  22. Ævar Arnfjörð BjarmasonJun 26, 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.