Re: "log --pretty=format:" language

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Teemu Likonen <tlikonen@xxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux