From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 4DB4D1F5AE for ; Fri, 21 May 2021 20:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbhEUU13 (ORCPT ); Fri, 21 May 2021 16:27:29 -0400 Received: from cloud.peff.net ([104.130.231.41]:33762 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbhEUU12 (ORCPT ); Fri, 21 May 2021 16:27:28 -0400 Received: (qmail 6330 invoked by uid 109); 21 May 2021 20:26:05 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 21 May 2021 20:26:05 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 12837 invoked by uid 111); 21 May 2021 20:26:05 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 21 May 2021 16:26:05 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 21 May 2021 16:26:04 -0400 From: Jeff King To: Felipe Contreras Cc: Junio C Hamano , Phillip Wood , git@vger.kernel.org, =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Leah Neukirchen , "Randall S. Becker" Subject: Re: [PATCH v4] help: colorize man pages Message-ID: References: <20210520040725.133848-1-felipe.contreras@gmail.com> <842221d6-51c4-e08a-4299-c4efb8bf1dcb@gmail.com> <60a7f57fe3301_5503920831@natae.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <60a7f57fe3301_5503920831@natae.notmuch> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, May 21, 2021 at 01:01:35PM -0500, Felipe Contreras wrote: > > I still don't understand what we gain by making this a Git feature, > > What do we gain by making `git diff` output color? Huh? Git is outputting the diff. Who else would output the 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? By exporting the environment variables that ask it to do so, just like you showed already? > > 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. ESC=$(printf '\33') export MANCOLORS="LESS_TERMCAP_md=$ESC[31m LESS_TERMCAP_me=$ESC[0m" export MANPAGER='sh -c "eval $MANCOLORS less"' man ls git help git At least on Linux, $MANPAGER is some weird limbo that is not run with the shell, but not just a simple command. Hence the extra layer of "sh". If I were actually planning to use this myself, I'd probably put it in a "manpager" script in my $PATH and just do MANPAGER=manpager. -Peff