]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: add --sort=width option to sort by file name width
authorCarl Edquist <edquist@cs.wisc.edu>
Fri, 26 Mar 2021 09:27:54 +0000 (04:27 -0500)
committerPádraig Brady <P@draigBrady.com>
Sun, 11 Apr 2021 13:58:38 +0000 (14:58 +0100)
commit751ad58e00a7cacfb511f651837d336253eb672c
treeb08372b78bfe5c2200bfa37eb39c1b6e13093876
parente3766c5db176ca7abbb8212d5b0b7862fb98a5be
ls: add --sort=width option to sort by file name width

This helps identify the outliers for long filenames, and also produces
a more compact display of columns when listing a directory with many
entries of various widths.

* src/ls.c (sort_type, sort_types, sort_width): New sort_width sort
type.
(sort_args): Add "width" sort arg.
(cmp_width, fileinfo_width): New sort function and helper for file name
width.
(quote_name_width): Add function prototype declaration.
(usage): Document --sort=width option.
* doc/coreutils.texi: Document --sort=width option.
* tests/ls/sort-width-option.sh: New test for --sort=width option.
* tests/local.mk: Reference new test.
* NEWS: Mention the new feature.
NEWS
doc/coreutils.texi
src/ls.c
tests/local.mk
tests/ls/sort-width-option.sh [new file with mode: 0755]