diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/interactive/widgets/mark.rs | 3 | ||||
-rw-r--r-- | src/main.rs | 27 |
2 files changed, 27 insertions, 3 deletions
diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index 0b38e99..4e5829a 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -102,6 +102,9 @@ impl MarkPane { pub fn marked(&self) -> &EntryMarkMap { &self.marked } + pub fn into_paths(self) -> impl Iterator<Item = PathBuf> { + self.marked.into_iter().map(|(_k, v)| v.path) + } pub fn process_events(mut self, key: Key) -> Option<(Self, Option<MarkMode>)> { let action = None; match key { diff --git a/src/main.rs b/src/main.rs index 4c75191..0596458 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,8 +89,18 @@ fn main() -> Result<()> { )? .map(|(keys_rx, mut app)| { let res = app.process_events(&mut terminal, keys_rx.into_iter()); - // Leak app memory to avoid having to wait for the hashmap to deallocate, which causes a noticeable delay shortly before the the - // program exits anyway. + + let res = res.map(|r| { + ( + r, + app.window + .mark_pane + .take() + .map(|marked| marked.into_paths()), + ) + }); + // Leak app memory to avoid having to wait for the hashmap to deallocate, + // which causes a noticeable delay shortly before the the program exits anyway. std::mem::forget(app); res }); @@ -99,7 +109,18 @@ fn main() -> Result<()> { io::stdout().flush().ok(); // Exit 'quickly' to avoid having to not have to deal with slightly different types in the other match branches - std::process::exit(res.transpose()?.map(|e| e.to_exit_code()).unwrap_or(0)); + std::process::exit( + res.transpose()? + .map(|(walk_result, paths)| { + if let Some(paths) = paths { + for path in paths { + println!("{}", path.display()) + } + } + walk_result.to_exit_code() + }) + .unwrap_or(0), + ); } Some(Aggregate { input, |