mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-09-28 21:29:02 +00:00
Fix header-printing logic
This commit is contained in:
parent
728e7dd976
commit
95388e6e90
@ -28,7 +28,7 @@ fn exa(options: &Options) {
|
|||||||
|
|
||||||
// It's only worth printing out directory names if the user supplied
|
// It's only worth printing out directory names if the user supplied
|
||||||
// more than one of them.
|
// more than one of them.
|
||||||
let mut print_dir_names = false;
|
let mut count = 0;
|
||||||
|
|
||||||
// Separate the user-supplied paths into directories and files.
|
// Separate the user-supplied paths into directories and files.
|
||||||
// Files are shown first, and then each directory is expanded
|
// Files are shown first, and then each directory is expanded
|
||||||
@ -49,7 +49,7 @@ fn exa(options: &Options) {
|
|||||||
Err(e) => println!("{}: {}", file, e),
|
Err(e) => println!("{}: {}", file, e),
|
||||||
}
|
}
|
||||||
|
|
||||||
print_dir_names = true;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut first = files.is_empty();
|
let mut first = files.is_empty();
|
||||||
@ -71,7 +71,7 @@ fn exa(options: &Options) {
|
|||||||
let unsorted_files = dir.files();
|
let unsorted_files = dir.files();
|
||||||
let files: Vec<File> = options.transform_files(unsorted_files);
|
let files: Vec<File> = options.transform_files(unsorted_files);
|
||||||
|
|
||||||
if print_dir_names {
|
if count > 1 {
|
||||||
println!("{}:", dir_name);
|
println!("{}:", dir_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user