Page MenuHomeFreeBSD

ls: --group-directories=first/last
ClosedPublic

Authored by pstef on Mon, Jan 6, 9:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 16, 4:12 PM
Unknown Object (File)
Sun, Jan 12, 6:15 AM
Unknown Object (File)
Sat, Jan 11, 3:50 PM
Unknown Object (File)
Sat, Jan 11, 7:05 AM
Unknown Object (File)
Fri, Jan 10, 6:30 PM
Unknown Object (File)
Fri, Jan 10, 12:03 PM
Unknown Object (File)
Fri, Jan 10, 8:12 AM
Unknown Object (File)
Fri, Jan 10, 5:33 AM
Subscribers

Details

Summary

Implement --group-directories-first for compatibility with GNU ls.

Also implement --group-directories which takes a parameter.
"first" is equivalent to --group-directories-first, "last" gives
reversed sorting.

Changes in sorting between elements of the same type (files,
directories) are not intended.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

pstef requested review of this revision.Mon, Jan 6, 9:30 PM
ziaee added a subscriber: ziaee.

I do not like long options. We have a different culture and tradition that has a steep learning curve, but has led to the last living usable, daily driveable CLI. Long options are great for scripts but ruin the usability of CLI as a UX. This is just a comment and not a request for changes or nack. Cc'ing community leaders for review, and manpages since this is a manpage change.

This is for compatibility with GNU ls, where this is an equally long option.
We already distribute a system where ls is an alias.

Supporting the GNU ls option (--group-directories-first) as a long option seems fine to me. For the FreeBSD-specific extension the similar long option is probably ok. If -G wasn't already claimed by color ls perhaps that would have been a good candidate, but there are very few remaining single-letter options.

bin/ls/ls.1
313

Does this need a note about not being compatible with POSIX? I note that --color is missing such a note but other single-letter extensions are annotated as such both in the option description and in the STANDARDS section.

bin/ls/ls.1
313

I don't have a good idea how to craft the words here.

Try to address comments from jhb.

This revision was not accepted when it landed; it landed in state Needs Review.Thu, Jan 16, 4:04 PM
This revision was automatically updated to reflect the committed changes.