On June 28, 2021 3:44 PM, Felipe Contreras wrote: >Randall S. Becker wrote: >> On June 28, 2021 3:02 PM, Felipe Contreras wrote: >> >Randall S. Becker wrote: >> >> On June 28, 2021 2:12 PM, Felipe Contreras wrote: >> >> >Felipe Contreras wrote: >> >> >> It has been suggested that we "educate our users" to configure >> >> >> less in the right way, instead of colorizing man pages ourselves [1]. >> >> >> >> >> >> The question is *how*? Nobody has answered that. >> >> >> >> >> >> This is a continuation of the thread below. >> >> > >> >> >> I am still waiting for an explanation. >> >> >> >> >> >> How does the user properly colorize man pages for both man and >> >> >> git in a way that works in all distributions? >> >> > >> >> >No response. >> >> >> >> I think you're looking for something does not exist because it is >> >> platform and environment dependent. >> > >> >Yes, but there's always some common denominator. >> > >> >> There are two ways to configure git to work with 'less' on NonStop >> >> and neither is identical to Ubuntu or Windows. >> > >> >But I'm not talking about configuring git to work with less. >> > >> >Once you have less configured, how do you add colors? For example how do you turn bold into red bold? >> > >> >> Don't even get me started on what less does in a TSO/ISPF >> >> environment where everything is some single colour on black unless >> >> your emulator supports 3279 emulation. >> > >> >Is it even possible to add color there? I'm talking about platforms where color is possible in the first place. >> > >> >> >It's safe to say at this point that nobody knows what that configuration would look like. >> >> >> >> Nobody, perhaps, knows how to do this on every platform in the >> >> known universe 😊. There is no "one way" to do this consistently everywhere. >> > >> >In the platforms where color is supported, and you have less, what does this do? >> > >> > LESS_TERMCAP_md=$'\e[1;31m' LESS_TERMCAP_me=$'\e[m' git help git >> >> This only works in bash/shell. So if you are not initiating from a shell, you cannot use this technique. > >I know. The technique is not the point. You can use whatever technique you want to get LESS_TERMCAP_md and LESS_TERMCAP_me set >on the environment before launching `git help git` in whatever way you want. > >Now, clearly that technique would vary platform by platform, which is precisely why I'm proposing to do it inside `git help` itself [1]. > >Clearly this would work on every platform that has less and color and it's technique-independent: > > setenv("LESS_TERMCAP_md", GIT_COLOR_BOLD_RED, 0); > setenv("LESS_TERMCAP_me", GIT_COLOR_RESET, 0); > >Would it not? Less is obviously used across the board (git log, git help, etc.). The assumption of the same starting point for all situations is not valid. For example: my own environment runs git from the following starting points (in order of frequency): 1. Cygwin (bash, yay, easy). 2. OSS (Posix-like, bash, easy). 3. Jenkins (dumb terminal, no colours or else the output gets messed up). 4. GUARDIAN (Not at all Posix-like, I have to supply my own environment variables and the terminal emulator is not vt220 compatible). 5. USS (Posix-like, bash, easy). 6. TSO/ISPF (Not at all Posix-like, I have to supply my own environment variables and the terminal emulator is not vt220 compatible). In the case of 2-4, this all happens on the same system. Same with 3,5,6. So I have to maintain multiple "less" profiles to maintain output sanity. I cannot do this using .bashrc or .profile because those do not apply. If I had to suffer a single definition set within git, I would lose my mind. Admittedly, I am in a highly complex situation, but it is a real one (ok, two because of a diverged path between NonStop and MVS) and there are hundreds in a similar situation. -Randall