coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] ls: add --sort=width (-W) option to sort by filename width


From: Pádraig Brady
Subject: Re: [PATCH] ls: add --sort=width (-W) option to sort by filename width
Date: Sat, 17 Apr 2021 12:31:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

On 15/04/2021 15:41, Michael Stone wrote:
On Thu, Apr 15, 2021 at 07:56:30AM -0500, Carl Edquist wrote:
Anyway, after some time if you find yourself wanting to use the feature a
lot but being bored to type --sort=width each time, maybe that will
provide more inclination to add a short option...

("Yes," you might say, "but that's what shell aliases are for."

But...don't you like munging short options? :)

"Search your feelings, Luke."

...

Lastly, in the help / manpage output, "width" will looks a bit lonely
among the sort options, as the only one without an accompanying short
option:

    --sort=WORD      sort by WORD instead of name: none (-U), size (-S),
                       time (-t), version (-v), extension (-X), width

And, it might be worth noting that in the help / manpage output, the
_only_ documentation (although pithy) for what the different sort types
actually do is in the description for their corresponding short options.

So, you lose the chance to document it in the --help output if you omit
the short opiton.

...


What do you think?  :)

I think it's a heck of a lot easier to add short options than it is to
remove them, and that there are more ideas for things to do than there
are letters. I'm on the side of make it a long option. In a few years if
it's a commonly used thing with a groundswell of demand for a short
option, it can always be added. There are a lot of existing short
options that aren't used very often, are redundant, or are simply
confusing, and it would be really nice (but impossible) to have those
letters back. Continuing the tradition of burning short options by
default just makes the hole deeper.

Right we must be more careful with short options.
In my mind they should be reserved for higher level
more conceptual ideas, rather than specific operations.

For example in this case one might have the concept
of a "most compact view possible", which might be
appropriate for a short option.

So in future one might support -z (compressed get it :)) to:
  - Enable --sort=width
  - Enable --format=vertical
  - Shrink column padding from 2 to 1 space
  - Disable extra padding around quoted files
  - ...

cheers,
Pádraig



reply via email to

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