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 17:04:39 +0100

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

  You know my opinion ... I guess it is worthwhile, as the consumer of
ls output is generally human and human wishes do differ. I'm ok with
--printf option, you are right - it would be better to keep conventions.

>   - 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 guess it should use find -printf style with some extensions. As ls
doesn't change much, I guess there will be not so many changes in the
interface in future. Some extensions would be necessary, some things,
maybe they could be mentioned explicitly in findutils and ls. Anyway it
is bad that there are already two different tools and interfaces (stat
--printf and find --printf) for exactly the same thing... as both are
usable only in scripts. Adding option to ls means human readability.
Additionally it would be good to unify stat --printf and find -printf
format at least for the %{filename} style format which was proposed as
possible future extension.

> 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.

  There were already some wishes/requests to add that feature to ls.
Additionally - as I said, if the implementation of ls --printf option
would be improved (and I think it could be improved easily), it could
even simplify the ls.c code, as format options could be replaced just by
--printf format strings - so functions like print_with_commas,
print_horizontal, print_many_per_line and others could be removed
completely.
  As Pádraig mentioned there are some implementations of 'ls-like'
utilities doing the same (sls, limo and maybe others) - always
mentioning that the utility is add-on to ls - simply because users
expect that feature from ls. And I guess it would be better to have it
centralized in ls...

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

  As the base code for ls --printf option (almost) exists, I hope I'll
be able to change the options (and to amend documentation) quite quickly
if the option with the objections from the discussion (at the moment I
guess verbosity on --help, different format from find -printf, name of
that option) will be generally accepted. Changing ls to use fts seems to
take much more time for me at the moment. But good TODO task...

Greetings,
         Ondřej

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


reply via email to

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