diff options
author | Ben S <ogham@bsago.me> | 2015-08-25 15:04:15 +0100 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-08-25 15:04:15 +0100 |
commit | 2a9b6fe93080ba00cf99c05db41076e843c8aae7 (patch) | |
tree | 7acbbeaeb8a335332fe4c85fa1a349b04c5dee0c /src/main.rs | |
parent | 7deb08644ac85656c61f1917f2011fa72ca9eb86 (diff) |
Display errors inline in the tree
When tree mode is active, this will print out errors as another form of child node in the tree, instead of in one big block before any output.
The 'this' field now holds the io::Result of the readdir call, rather than only a *successful* result.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index a5f180c..33fca6e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![feature(iter_arith)] #![feature(convert, fs_mode)] #![feature(slice_splits, vec_resize)] @@ -146,7 +147,15 @@ impl<'dir> Exa<'dir> { match Dir::readdir(&dir_path, self.options.should_scan_for_git()) { Ok(ref dir) => { - let mut files = dir.files(false).flat_map(|f| f).collect(); + let mut files = Vec::new(); + + for file in dir.files(true) { + match file { + Ok(file) => files.push(file), + Err((path, e)) => println!("[{}: {}]", path.display(), e), + } + } + self.options.transform_files(&mut files); // When recursing, add any directories to the dirs stack |