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: Jim Meyering
Subject: Re: [PATCH]: ls: add --user-format option for user defined format
Date: Thu, 20 Nov 2008 14:15:35 +0100

Ondřej Vašík <address@hidden> wrote:
> 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

Actually, ever since find got its -printf option, I've thought of
adding the same to ls.  But the size of the code addition as well as
the logistics (this was before gnulib) were off-putting, not to mention
the fact that this is ls, after all.  That combined to make the overall
cost/benefit ratio appear way too high.

Here are my questions:

  - is it worthwhile to add a --printf option to ls?
      I don't like the --user-format name)

  - if so, should it use use a find -printf-compatible format string
      or one compatible to stat --printf?  Either way, it'll need a few
      extensions.

I'm still on the fence.  On the one hand, I don't like to bloat
ls further, even if it ends up using code that's shared with GNU find.
On the other, I understand and sympathize with the desire to make ls
output more useful/readable.

Finally, if investing in ls, I'd rather invest in converting it to use
fts for its hierarchy traversal.




reply via email to

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