Re: ls with user-specified attribute columns

From: Paul Hepworth <paul1+vsta_at_nospam.org>
Date: Tue Mar 02 2004 - 12:05:26 PST

> >If so, what would be your preferred syntax for distinguishing file and
field
> >names?
> >(e.g., stat --files file1 file2 --fields field1 field2)
>
> Since I've never needed to use stat this way, I'm not sure what we should
> optimize for. Actually, we should optimize so the current usage (which
are,
> in my experience, the most common ones to date) are still accomodated.
That
> said, it looks like you're optimizing for display of multiple fields
across
> multiple files. I bet formatting will become an issue, have you
considered
> a more printf-like command?

I think simply tab-delimiting would be fine; we could always post-process
from there.

usage: stat [options] files fields
output:
file1 field1 field2 field3
file2 field1 field2 field3

new option: -h (header):
stat -h foo a b c
output:
file a b c
foo 1 2 3

The problem is that the split between files and fields is ambiguous:
stat a b c
Is it file a, fields b and c or files a and b, field c, etc.?

Options:

support explicit grouping options (as with ld --start-group):
stat --start-group file1 file2 --end-group field1 field2

option for split point:
stat file1 file2 -- field1 field2
(This is common to mean that everything after -- is a filename even if it
begins with -; but these are field names rather than file names.)
alternate form:
stat file1 file2 --fields field1 field2
for consistency, optional --files:
stat --files file1 file2 --fields field1 field2

My vote is for the "split point" option (all three variations):
--files
--fields
-- (equivalent to --fields)

I'd want to reject mixes of files and fields (at least initially):
stat --files a b --fields a b --files c d
(error)

BTW, in another message, you wrote:
> stat -w -- xkeys=0
What's the -- for here?
(sure wish there were man stat)

Paul
Received on Tue, 2 Mar 2004 13:05:26 -0700

This archive was generated by hypermail 2.1.8 : Tue Sep 26 2006 - 09:03:09 PDT