bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: ls: add --user-format option for user defined format


From: Ondřej Vašík
Subject: Re: [PATCH]: ls: add --user-format option for user defined format
Date: Thu, 20 Nov 2008 12:14:04 +0100

Pádraig Brady wrote:
> Ondřej Vašík wrote:
> > Let's do some summary, feel free to add/comment items if you have
> > something not mentioned here:
> > 
> > What patched ls --user-format can and upstream find -printf not:
> > 1) colored files by LS_COLORS or automatically if requested
> > 2) could be used simply as ls alias for normal users - as they could
> > still specify additional ls options like time-style, quoting-style,
> > sorting style, blocksize, units and other things without modifying
> > format string
> > 6) Automated column width computation (in find -printf you have to
> > hardcode the column width in %N.NX syntax yourself, otherwise there is
> > no defined human-readable column structure.)
> 
> > I guess points #1, #2, #6 are the most important things, as #1 and #2
> > makes the output more user friendly and #6 generally readable by human
> 
> Right.
> 
> As I see it ls output is tuned for human consumption,
> while find is tuned for further consumption by other scripts/utils.

Exactly - I have the same opinion and I wrote it in the previous
email ... and as humans do differ and they could have different wishes
about format of output, I would expect something to tune output in ls -
without processing through awk/sed/whatever utilities.

> In my experience I've only needed to tweak output like this
> to ease the subsequent processing in scripts/utils. I.E. I've never needed it 
> in ls,

I'm quite sure that you (and Jim) never needed that option. Otherwise it
would had been already implemented. In my case it is slightly different.
I never needed that option, but I sometimes wished to have it.  For me
is ls -l too verbose and other ls formats too simple. I would like to
have something like with format "colored_name_with_link
(owner:group:filetype:octalmode) Human-readable_size" - so e.g.

bar              (bar :root:-:0664)  24K
baz              (baz :root:-:0664) 100K
bazlink -> ./baz (root:root:l:0777)    5
foo              (foo :foo :-:0664)  10K

That would be enough for me in most cases (octal form is enough for me,
in most cases I don't need ACL char, number of links and mostly not even
the time). Now I have to parse things out of very verbose long format
(and every user has to parse it). Easy, but I wish to have another
choice - and this choice could be --user-format option.

> I'm not sure it's
> worth duplicating this in ls (adding a lot of interface
> for all users to parse and most ignore).

You are right, it is a lot of interface for all users to parse. So
probably user-format description should be removed from --help
completely - and there should be only pointer that format is described
in info documentation.

Greetings,
         Ondrej

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]