Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls: Implement new sort option --sort=width #4954

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

Skryptonyte
Copy link
Contributor

This option was introduced in some more recent versions of GNU coreutils (around 2021-4-11) which lets you sort by filename widths .

One oddity of this particular option in GNU coreutils is that unlike other sort options, this one does not have a shorthand form flag so I have implemented it similarly as such here.

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

GNU testsuite comparison:

Congrats! The gnu test tests/ls/sort-width-option is no longer failing!

@Skryptonyte Skryptonyte changed the title Implement new sort option --sort=width ls: Implement new sort option --sort=width Jun 6, 2023
@cakebaker
Copy link
Contributor

Thanks for your PR!

Can you please run cargo fmt?

@Skryptonyte
Copy link
Contributor Author

Yeah sure thing! Was out for a bit, will it get to it soon.

Copy link
Contributor

@cakebaker cakebaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you have multiple file names with the same width?

@Skryptonyte
Copy link
Contributor Author

Right, now it should fall back to alphabetic sorting in those cases. Also extended the test case to check for those as well.

@cakebaker cakebaker merged commit 0128198 into uutils:main Jun 6, 2023
@cakebaker
Copy link
Contributor

Great work, thanks :)

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

GNU testsuite comparison:

Congrats! The gnu test tests/ls/sort-width-option is no longer failing!
Congrats! The gnu test tests/tail-2/inotify-dir-recreate is no longer failing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants