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: Paul Eggert
Subject: Re: [PATCH]: ls: add --user-format option for user defined format
Date: Fri, 21 Nov 2008 10:24:56 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Jim Meyering <address@hidden> writes:

>   - 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 think it's worthwhile (as long as someone else does it :-) but I'm
afraid that neither find's nor stat's printf options are up to ls's main
task, which is to generate nice output for humans.

ls is pretty good about lining up columns, even when the column data is
unexpectedly wide, whereas 'find' and 'stat' are not.  I would expect
that a -printf option to 'ls' would normally autoadjust column widths,
but neither 'find' nor 'stat' does that now.

I don't see a strong need to maintain absolute compatibility with find
-printf or with stat -printf.  Obviously we shouldn't be gratuitously
compatible, but we might as well do it 'right' for 'ls', propagating any
improvements to 'stat'.  (find -printf is not standardized by POSIX, so
there's not a huge portability issue there.)

I just now looked at the documentation for stat -printf and find
-printf.  The stat documentation is easier to read, and has some
features that I'd expect people would find useful (e.g., quoting file
names with funny characters).  The find documentation has some fancy
features for time stamp formatting, which I couldn't figure out from the
documentation; I suggest cleaning that up in 'ls', for example, by
having a --time-format=FORMAT option that specifies the time format in a
strftime-like way.




reply via email to

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