[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Split the functions of `cvs update'?

From: Bruce Korb <bkorb_at_sco.COM>
Date: 2000-10-27 20:19:00 CEST

Karl Fogel wrote:
> > One idea I had in my command-line notes was a "script" prefix for
> > commands --- it could be a global flag, too --- which adjusts the
> > syntax of the output for reliable parsing by scripts. Colon-separated
> > fields, simpler argument parsing, or whatever folks feel is useful.
>
> If we could achieve auto-parseable default outputs that are also human
> readable, that's even better. Let's try for that way first. CVS
> *almost* manages it in a lot of places -- and the changes that would
> be necessary to make things fully script-friendly are usually ones
> that would make the output more human-friendly too, I think.

I think here we should take a page from RPM (post 1.0 ;-).
When spitting out data from an ``rpm --query'' command:

       The general form of an rpm query command is

            rpm -q [query-options]

       You may specify the format that package information should
       be printed in. To do this, you use the [--queryformat|-qf]
       option, followed by the format string.

       Query formats are modifed versions of the standard
       printf(3) formatting. The format is made up of ... and
       printf(3) type formatters. As rpm already knows the type
       to print, the type specifier must be omitted however, and
       replaced by the name of the header tag to be printed,
       enclosed by {} characters.

At the risk of causing a ``not another library'' flame fest,
may I suggest yet another library? :-) With the snprintfv
library (which is in the process of being incorporated into
libiberty, BTW), you can register a callback for the format
specifier (as rpm does above). So:

   "%-10{ver}..."

could be used to left justify a 10 character field for the version.
So, you just select a very useful one-line format for the default
and give people lots of rope....
Received on Sat Oct 21 14:36:13 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.