git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Nathan Panike <nathan.panike@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 0/2] Use %as and %cs as pretty format flags
Date: Fri, 29 Aug 2008 01:12:18 -0700 (PDT)	[thread overview]
Message-ID: <m3hc94qlyc.fsf@localhost.localdomain> (raw)
In-Reply-To: <20080828235420.GB30195@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> On Thu, Aug 28, 2008 at 04:36:51PM -0700, Junio C Hamano wrote:
> 
> > I was actually thinking about rejecting this, asking for something that
> > allows to express all the other %[ai][dDri] format can express, and
> > perhaps more.  So I think "%ad(short)" is a good direction to go, except
> > that 'd' is already taken.  Perhaps %a(date), %a(shortdate,local),...?
> 
> I was thinking we could accept %ad _or_ %ad(short), but of course
> introducing the latter can break existing "%ad(my other random text)"
> which is a bad idea.
> 
> I really think some consideration should be given to introducing
> arbitrary "arguments" to formatting specifiers, of which this is one
> example. Another that has been mentioned is pulling an arbitrary element
> from a list.
> 
> How do you feel about a brand new syntax (and supporting the old, of
> course) that is syntactically a little easier to extend. Like:
> 
>   %(macro, key=val, key=val)
> 
> e.g.
> 
>   %(authordate, format=short, tz=local)
> 
> where the syntax can be easily parsed without understanding what
> "authordate" means.  Jakub already suggested something akin to RPM's
> macro expansion, though I haven't looked too closely at it.

I'd rather we do not introduce yet another pretty-printing /
formatting syntax, and use the same syntax as git-for-each-ref uses
for extra formatting, 

  As a special case for the date-type fields, you may specify a format for
  the date by adding one of `:default`, `:relative`, `:short`, `:local`,
  `:iso8601` or `:rfc2822` to the end of the fieldname; e.g.
  `%(taggerdate:relative)`.

which incindentally (or not) is the same as rpm uses

  Alternate output formats may be requested by following the tag with  :type-
  tag.  Currently, the following types are supported:

  :armor  Wrap a public key in ASCII armor.

  :base64
         Encode binary data using base64.

  :date  Use strftime(3) "%c" format.

  :day   Use strftime(3) "%a %b %d %Y" format.

  :depflags
         Format dependency flags.

  :fflags
         Format file flags.

  :hex   Format in hexadecimal.

  :octal Format in octal.

  :perms Format file permissions.

  :shescape
         Escape single quotes for use in a script.

  :triggertype
         Display trigger suffix.

P.S. I Agree with %ad and the like respecting --date=<type>
-- 
Jakub Narebski
Poland
ShadeHawk on #git

  parent reply	other threads:[~2008-08-29  8:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28 11:09 [PATCH 0/2] Use %as and %cs as pretty format flags Nathan Panike
2008-08-28 23:15 ` Jeff King
2008-08-28 23:36   ` Junio C Hamano
2008-08-28 23:54     ` Jeff King
2008-08-29  0:10       ` Nathan W. Panike
2008-08-29  0:54         ` Jeff King
2008-08-29  1:08           ` Junio C Hamano
2008-08-29  8:12       ` Jakub Narebski [this message]
2008-08-29  3:43     ` Avery Pennarun

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=m3hc94qlyc.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nathan.panike@gmail.com \
    --cc=peff@peff.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).