ls: allow crate users to call ls without having to print everything to stdout (#9851)

* refactor uu_ls so that crate users can call the command without having
the internal print stdout output

* redo changes

* clippy

* help cspell understand dired

* rebase

* try and optimize for memory and speed performance.

update output handling to add streaming mode.

* work on ci issues, optimize uid and gid cache handling, improve dired output calculations

* test fx: change read_dir parameter to mutable reference in collect_directory_entries and enter_directory functions

* update documentation

* more perf tweaks

* fmt

* tweak perf

* Add back (and shorten) comment for 31_556_952

* Update src/uu/ls/src/ls.rs

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Update src/uu/ls/src/ls.rs

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Darren Schroeder
2026-04-17 14:26:23 +02:00
committed by GitHub
co-authored by Daniel Hofstetter Sylvestre Ledru
parent 3194190535
commit ceb09c7014
4 changed files with 782 additions and 248 deletions
+2 -2
View File
@@ -5340,7 +5340,7 @@ fn test_ls_dired_recursive_multiple() {
.map(|chunk| {
let start_pos = chunk[0];
let end_pos = chunk[1];
let filename = String::from_utf8(output.as_bytes()[start_pos..=end_pos].to_vec())
let filename = String::from_utf8(output.as_bytes()[start_pos..end_pos].to_vec())
.unwrap()
.trim()
.to_string();
@@ -5486,7 +5486,7 @@ fn test_ls_dired_complex() {
.map(|chunk| {
let start_pos = chunk[0];
let end_pos = chunk[1];
let filename = String::from_utf8(output.as_bytes()[start_pos..=end_pos].to_vec())
let filename = String::from_utf8(output.as_bytes()[start_pos..end_pos].to_vec())
.unwrap()
.trim()
.to_string();