diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-09-04 15:00:56 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-09-04 15:00:56 -0400 |
commit | 7741d4d2c8798ad0bb609e97fb3bda86c5318a36 (patch) | |
tree | 0176023bbe8dfff48198ba960f64a08ee785569f /src/util | |
parent | e6e35948545bfa14d672cafae92c2c8c153ba708 (diff) |
io operations now give more information
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/event.rs | 2 | ||||
-rw-r--r-- | src/util/sort.rs | 2 | ||||
-rw-r--r-- | src/util/worker.rs | 19 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/util/event.rs b/src/util/event.rs index fca1edb..f019b80 100644 --- a/src/util/event.rs +++ b/src/util/event.rs @@ -5,7 +5,7 @@ use std::thread; use termion::event::Key; use termion::input::TermRead; -use crate::io::{FileOp, IOWorkerProgress}; +use crate::io::IOWorkerProgress; #[derive(Debug)] pub enum Event { diff --git a/src/util/sort.rs b/src/util/sort.rs index fcef409..cd0b84a 100644 --- a/src/util/sort.rs +++ b/src/util/sort.rs @@ -90,7 +90,7 @@ impl SortOption { s => s, }; } - return res; + res } pub fn filter_func(&self) -> fn(&Result<fs::DirEntry, std::io::Error>) -> bool { diff --git a/src/util/worker.rs b/src/util/worker.rs index a8bc66d..8689d8a 100644 --- a/src/util/worker.rs +++ b/src/util/worker.rs @@ -8,13 +8,21 @@ pub fn process_worker_progress(context: &mut JoshutoContext, res: IOWorkerProgre let size_str = format::file_size_to_string(res.processed); match res.kind { FileOp::Cut => { - let msg = format!("moving ({}/{}) {} completed", - res.index + 1, res.len, size_str); + let msg = format!( + "moving ({}/{}) {} completed", + res.index + 1, + res.len, + size_str + ); context.set_worker_msg(msg); } FileOp::Copy => { - let msg = format!("copying ({}/{}) {} completed", - res.index + 1, res.len, size_str); + let msg = format!( + "copying ({}/{}) {} completed", + res.index + 1, + res.len, + size_str + ); context.set_worker_msg(msg); } } @@ -37,8 +45,7 @@ pub fn process_finished_worker( FileOp::Cut => "moved", }; let size_str = format::file_size_to_string(progress.processed); - let msg = format!("successfully {} {} items ({})", - op, progress.len, size_str); + let msg = format!("successfully {} {} items ({})", op, progress.len, size_str); context.push_msg(msg); } Err(e) => { |