Benjamin Sago 11 лет назад
Родитель
Сommit
95388e6e90
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/exa.rs

+ 3 - 3
src/exa.rs

@@ -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);
                 }
                 }