mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 17:58:06 +00:00
ls: Fix minor output mismatch
When a single directory is passed to ls in recursive mode, uutils ls won't print the directory name ====================== GNU ls: z: ====================== ====================== uutils ls: ====================== This commit fixes this minor inconsistency and adds corresponding test.
This commit is contained in:
parent
4d51e16140
commit
898d325aea
2 changed files with 7 additions and 1 deletions
|
@ -1223,7 +1223,7 @@ fn list(locs: Vec<String>, config: Config) -> i32 {
|
|||
|
||||
sort_entries(&mut dirs, &config);
|
||||
for dir in dirs {
|
||||
if locs.len() > 1 {
|
||||
if locs.len() > 1 || config.recursive {
|
||||
let _ = writeln!(out, "\n{}:", dir.p_buf.display());
|
||||
}
|
||||
enter_directory(&dir, &config, &mut out);
|
||||
|
|
|
@ -899,6 +899,12 @@ fn test_ls_recursive() {
|
|||
|
||||
scene.ucmd().arg("a").succeeds();
|
||||
scene.ucmd().arg("a/a").succeeds();
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("z")
|
||||
.arg("-R")
|
||||
.succeeds()
|
||||
.stdout_contains(&"z:");
|
||||
let result = scene
|
||||
.ucmd()
|
||||
.arg("--color=never")
|
||||
|
|
Loading…
Reference in a new issue