Thread (40 messages) flat view 40 messages, 7 authors, 2016-06-15

Re: [PATCH v2 0/5] Pretty formats for reflog data

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:47:34

Jeff King [off-list ref] writes:
On Fri, Oct 16, 2009 at 12:41:43AM +0200, Thomas Rast wrote:
quoted
I think going for %(...) wouldn't be too bad since we already have
that in for-each-ref, and it can be backwards compatible.  So we would
have different sets of short and long specifiers, e.g.

  %ae = %(authoremail)
  %aE = %(authoremail:mailmap)

We can then pass arguments via some yet-to-be decided syntax, say,
%(body:indent(10)).
That seems reasonable to me, though if we can limit ourselves to one
argument per specifier (I suspect most specifiers would simply be
boolean, but a few may take numbers or strings), then something like
%(body:indent=10) might be a little more readable.

It would also be nice to have some sort of conditional inclusion, which
could deal with your extra ": " in patch 3. Either something like:

  %(reflog:short)%(reflog:+: )

or even

  %(reflog:short:prefix=\: )

and note that allowing arbitrary arguments means we get to deal with
quoting.

But that is all for another potential series.
Or we could go the whole nine miles, and implement some subset of
advanced shell syntax, 

  %(parameter:-word)
  %(parameter:=word)
  %(parameter:?word)
  %(parameter:+word)

RPM spec syntax, 

  %(?parameter)      # expand if exists
  %(!?parameter)     # expand if does not exists
  %(?parameter:literal)
  %(!?parameter:literal)

or RPM queryformat

  %10(parameter)
  %-30(parameter)

  [    %(messagebody)\n]   # messagebody is list of lines
  [%(=param) %(list)\n]    # param is not a list; repeat it

  %|parameter?{present}:{missing}|

  %(parameter:date)
  %(parameter:shescape)

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help