public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Ramkumar Ramachandra <artagnon@gmail•com>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color
Date: Mon, 18 Nov 2013 08:24:34 -0800	[thread overview]
Message-ID: <xmqq4n79d6f1.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CALkWK0k4MudojZt4PkLjnq0uZe322n30WP-=N0ckLw2QcnbzMA@mail.gmail.com> (Ramkumar Ramachandra's message of "Thu, 14 Nov 2013 12:33:05 +0530")

Ramkumar Ramachandra <artagnon@gmail•com> writes:

> Junio C Hamano wrote:
>> Perhaps like this (obviously not tested as these three patches did
>> not add any tests ;-)
>
> Sorry about that. I didn't notice t6300-for-each-ref.sh. Will fix in
> the next round.
>
>> I also think that there should be a mechanism to do "color:reset"
>> after each record is issued automatically, and also have the color
>> output honor --color=auto from the command line, i.e.
>>
>>         git for-each-ref --color=auto --format='%(color:blue)%(subject)' | cat
>>
>> should turn the coloring off.
>
> We can add --color=auto later, but I'm wondering about auto-reset
> color after each token. What happens if I do:
>
>   $ git for-each-ref --format='%(subject)%(color:blue)'
>
> No color, right? So, it should be auto-reset color after each token
> _and_ at end of format-string.

If you are saying, by after each token, that

	--format='%(color:blue)%(A)literal string%(B)'

should result in

	<color blue> <value for A> <color reset> "literal string" <value for B>

then I would disagree.  I was suggesting it to instead produce

	<color blue> <value for A> "literal string" <value for B> <color reset>

where the <color reset> always comes when some color is used and we
hit the end of the format string. A bonus point if we can make it so
that we emit the final reset only when the last "%(color:some)" is
not "%(color:reset)", but unconditional "reset if we ever used
color" is fine.

Thanks.

  reply	other threads:[~2013-11-18 16:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13  9:36 [PATCH v2 0/3] Minor f-e-r enhacements Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 1/3] for-each-ref: introduce %(HEAD) asterisk marker Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 2/3] for-each-ref: introduce %(upstream:track[short]) Ramkumar Ramachandra
2013-11-13 19:42   ` Junio C Hamano
2013-11-13 19:44     ` Junio C Hamano
2013-11-14  6:53     ` Ramkumar Ramachandra
2013-11-13  9:36 ` [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color Ramkumar Ramachandra
2013-11-13 20:01   ` Junio C Hamano
2013-11-13 20:19     ` Junio C Hamano
2013-11-14  7:03       ` Ramkumar Ramachandra
2013-11-18 16:24         ` Junio C Hamano [this message]
2013-11-18 16:45           ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4n79d6f1.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=artagnon@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox