summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-06-08 09:31:57 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2021-06-08 09:31:57 +0800
commit017cbd7b4c3e57e1a98fbc595159be39bc97c708 (patch)
tree5a52c5d8fca5011a23ab7f3394388fea61bf8fed /src/main.rs
parentc8d5650be77e000801b282c4c0a3861e710de6d8 (diff)
Print marked items upon exit if these are left in the marked pane
Fixes #87
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs27
1 files changed, 24 insertions, 3 deletions
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,