Skip to content

ls: allow --sort, --format, --time, --block-size without '=' - #13308

Closed
koopatroopa787 wants to merge 1 commit into
uutils:mainfrom
koopatroopa787:fix-ls-require-equals
Closed

ls: allow --sort, --format, --time, --block-size without '='#13308
koopatroopa787 wants to merge 1 commit into
uutils:mainfrom
koopatroopa787:fix-ls-require-equals

Conversation

@koopatroopa787

Copy link
Copy Markdown
Contributor

Summary

ls --sort name / fails with:

error: equal sign is needed when assigning values to '--sort=<field>'

The four options --sort, --format, --time, and --block-size had
.require_equals(true) in their clap definition, which forced the
--opt=value syntax and rejected the space-separated --opt value
form. GNU ls accepts both forms.

Fix

Remove .require_equals(true) from the four affected options.

The optional-value flags --color, --classify, and --hyperlink are
not changed — they use num_args(0..=1) with a default_missing_value,
and they legitimately need require_equals so clap can tell whether
the next word is the option's value or a file operand.

--sort, --format, --time, and --block-size always consume
exactly one value, so the space-separated form is unambiguous.

Changes

  • src/uu/ls/src/ls.rs: remove .require_equals(true) from FORMAT,
    TIME, SORT, and size::BLOCK_SIZE.
  • tests/by-util/test_ls.rs: four regression tests, one per option.

Fixes #13280

These four options used .require_equals(true) in clap, which forced
users to write --sort=name instead of the GNU-compatible --sort name.
GNU ls accepts both forms, so this was a regression.

The optional-value flags --color, --classify, and --hyperlink keep
.require_equals(true) because they have num_args(0..=1) and a
default_missing_value — without the equals sign clap cannot tell whether
the next word is the option's value or a file operand.

--sort, --format, --time, and --block-size always require exactly one
argument, so the space-separated form is unambiguous and matches GNU.

Adds four regression tests (one per fixed option).

Fixes uutils#13280
Copilot AI review requested due to automatic review settings July 7, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/unexpand/bounded-memory is now being skipped but was previously passing.

@cakebaker

Copy link
Copy Markdown
Contributor

Duplicate of #13281

@cakebaker cakebaker marked this as a duplicate of #13281 Jul 9, 2026
@cakebaker cakebaker closed this Jul 9, 2026
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.

ls: --sort, --format, --time, --block-size require equals sign, but shouldn't

3 participants