RFC: generic command line output templating

Martin Geisler mg at aragost.com
Wed Sep 28 07:19:27 CDT 2011


Frank Kingswood <frank at kingswood-consulting.co.uk> writes:

> On 27/09/11 20:47, Matt Mackall wrote:
>> A frequent request is to add --template support to more commands.
>> Here's my proposal on how to make our output engine do this
>> generically.
>>
>> First, observe that the basic problem is to go from an internal
>> representation to an external representation with a built-in default.
>> Also observe that almost all of our output can be viewed as a list of
>> elements made up of key/value pairs. For instance, log is a list of
>> changesets with hash/author/date/summary values and status is a list
>> of state/filename pairs.
>
> Yes, yes, excellent idea.

I like the idea too!

> Many or indeed most values are strings but have wildly differing
> interpretations, so they would need either some additional metadata to
> be passed or to be wrapped to help choosing the default representation
> without having to code the key names each of them in the templater.
>
> Don't forget a pickle output formatter.
> Am I wrong or would this make cmdserver trivial?

I would say that this is orthogonal: the goal of the command server was
to remove the startup overhead, not to make the output easier to parse.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list