All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: Jeff King <peff@peff.net>,
	MichaelTiloDressel@t-online.de,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: "log --pretty=format:" language
Date: Sun, 24 Aug 2008 11:30:38 -0700 (PDT)	[thread overview]
Message-ID: <m33akus1tj.fsf@localhost.localdomain> (raw)
In-Reply-To: <20080821050223.GA3295@mithlond.arda.local>

Teemu Likonen <tlikonen@iki.fi> writes:

> Jeff King wrote (2008-08-20 14:00 -0400):
> 
> > There is a lot of room for discussion here.
> > 
> > For example:
> > 
> >   - what should %d show? Right now it shows each decoration, split by
> >     commas. It doesn't show the enclosing parentheses automatically.
> > 
> >     Is this too strict? Should there be some way of pulling out
> >     individual decorations from the list, or specifying a different
> >     delimiter? If so, probably that should be part of a general
> >     improvement in the format expansion macro language.
> 
> If such "general improvement" takes place I'd like to point out (most 
> likely old news, but anyway) that %b can't be indented in practical 
> sense. For example [...]

We can take a look how rpm handling of --queryformat option handles
it.  

First, it uses %{NAME} notation instead of %X shorthand for writing
single header (git-for-each-ref uses %(name) instead, so we might want
to use %(...) instead of %{...}, or use both).  It allows use of
printf(3) type formatters, which include field width and align, for
example "%-30{NAME} %10{SIZE}\n".

Second, for displaying arrays (like list of files, or list of
dependencies) or multi line output like package description it prints
each item in the array, or each line in multi-line field within qeuare
brackets, e.g. "[%-50{FILENAMES} %10{FILESIZES}\n]".  If one want to
repeat single-valued field one should use %{=NAME} syntax (actually it
simply takes first line/first element of array), e.g. 
"[%{=NAME}: %{FILENAMES}\n]"

Queryformat minilanguage is more reach, see /usr/share/doc/rpm-*/queryformat
or http://rpm5.org/docs/api/queryformat.html

-- 
Jakub Narebski
Poland
ShadeHawk on #git

      reply	other threads:[~2008-08-24 18:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 12:25 [BUG?] git log does not decorate when custom format is used MichaelTiloDressel
2008-08-20 17:53 ` Jeff King
2008-08-20 17:55   ` [PATCH 1/2] decorate: allow const objects to be decorated Jeff King
2008-08-20 18:00   ` [PATCH 2/2] allow '%d' pretty format specifier to show decoration Jeff King
2008-08-20 18:32     ` Junio C Hamano
2008-08-20 18:43     ` Johannes Schindelin
2008-08-20 19:01       ` Junio C Hamano
2008-08-20 19:53         ` Johannes Schindelin
2008-09-03 19:36       ` Jeff King
2008-08-20 19:51     ` Michael Dressel
2008-08-20 20:21       ` Junio C Hamano
2008-08-20 21:05         ` Michael Dressel
2008-08-21  5:02     ` "log --pretty=format:" language Teemu Likonen
2008-08-24 18:30       ` Jakub Narebski [this message]

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=m33akus1tj.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=MichaelTiloDressel@t-online.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.