You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ls: Implement -f flag to disable sorting and enable -a (#8824)
* ls: implement -f flag with correct constant, color logic, and localization
Fix the -f flag implementation to properly enable all files display,
disable sorting, and handle color output correctly.
Changes:
- Correct UNSORTED_ALL constant from 'unsorted-all' to 'f'
- Fix color logic to honor explicit --color flag regardless of -f position
- Add French localization for ls-help-unsorted-all
- Add comprehensive integration tests for -f flag behavior
The explicit --color flag now always takes precedence over -f implicit
color disabling, matching expected CLI behavior.
* tests(ls): improve -f flag test assertions
Address maintainer feedback from PR #8824 review:
1. test_f_flag_disables_sorting: Compare -f output with -a (sorted) and -U (unsorted)
to prove sorting is actually disabled, not just that files appear in output
2. test_f_overrides_big_a: Rename from test_f_overrides_a_and_big_a and fix assertions
to check for .. presence (distinguishes -f from -A) instead of .hidden (shown in both)
3. test_f_overrides_sort_flags: Use size-based files and explicit output comparisons
to verify last-flag-wins behavior with deterministic ordering
4. test_big_u_overrides_f_sort: Use size-based files and verify -U participates
in last-flag-wins by checking actual output order
All tests now properly validate flag interactions instead of just checking file presence.
* refactor(ls): use match expression in extract_sort
Replace if/else chain with match expression for improved readability
and more idiomatic Rust code. Uses match guards for index comparisons.
Addresses maintainer feedback from PR #8824 review.
No functional changes - behavior remains identical.
* fix(ls): use snake_case for test variable names
Follow Rust naming conventions by converting variable names in -f flag
tests from mixed case (out_Af, out_fS, etc.) to snake_case (out_a_f,
out_f_s, etc.). This eliminates clippy warnings about non_snake_case
identifiers.
* tests: fix flaky ls tests that depend on filesystem directory order
The tests test_f_flag_disables_sorting, test_big_u_overrides_f_sort, and
test_f_overrides_sort_flags made incorrect assumptions that unsorted
directory order would always differ from sorted order. However,
fs::read_dir() returns entries in filesystem-dependent order which may
accidentally match sorted order on some filesystems.
Changes:
- Removed assertions comparing unsorted vs sorted outputs
- Added deterministic checks (e.g., verifying --sort after -f works)
- Added explicit order verification for size-sorted outputs
- Tests now verify flag precedence without relying on directory order
Fixes CI failures on Windows and SELinux platforms.
Quality checks passed:
- cargo fmt --check: ✓
- cargo clippy --test tests: ✓
- all 3 modified tests pass: ✓
* test: fix misleading test name for -U flag behavior
Renamed test_big_u_overrides_f_sort to test_big_u_participates_in_sort_flag_wins
to accurately reflect that it tests -U with -S interactions, not -f.
Copy file name to clipboardExpand all lines: src/uu/ls/locales/fr-FR.ftl
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,7 @@ ls-help-author = Afficher l'auteur en format long. Sur les plateformes supporté
82
82
ls-help-all-files = Ne pas ignorer les fichiers cachés (fichiers dont les noms commencent par '.').
83
83
ls-help-almost-all = Dans un répertoire, ne pas ignorer tous les noms de fichiers qui commencent par '.',
84
84
ignorer seulement '.' et '..'.
85
+
ls-help-unsorted-all = Liste tous les fichiers dans l'ordre du répertoire, non triés. Équivalent à -aU. Désactive --color sauf si spécifié explicitement.
85
86
ls-help-directory = Lister seulement les noms des répertoires, plutôt que le contenu des répertoires.
86
87
Ceci ne suivra pas les liens symboliques à moins qu'une des options
87
88
`--dereference-command-line (-H)`, `--dereference (-L)`, ou
0 commit comments