mirror of
https://github.com/Dummi26/rembackup.git
synced 2025-03-10 05:13:54 +01:00
display total size of added files before copying
This commit is contained in:
parent
6566b42697
commit
e535e5fcfd
42
src/main.rs
42
src/main.rs
@ -101,34 +101,34 @@ fn main() {
|
||||
}
|
||||
}
|
||||
eprintln!(" - - - - -");
|
||||
eprintln!(
|
||||
" >> add directory | {}x",
|
||||
changes
|
||||
let add_dir_count = changes
|
||||
.iter()
|
||||
.filter(|c| matches!(c, IndexChange::AddDir(..)))
|
||||
.count()
|
||||
);
|
||||
eprintln!(
|
||||
" + add/update file | {}x",
|
||||
changes
|
||||
.count();
|
||||
eprintln!(" >> add directory | {add_dir_count}x");
|
||||
let (add_file_count, add_file_total_size_gib) = changes
|
||||
.iter()
|
||||
.filter(|c| matches!(c, IndexChange::AddFile(..)))
|
||||
.count()
|
||||
);
|
||||
eprintln!(
|
||||
" - remove file | {}x",
|
||||
changes
|
||||
.filter_map(|c| {
|
||||
if let IndexChange::AddFile(_, f) = c {
|
||||
Some(f)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.fold((0, 0.0f64), |(c, s), f| {
|
||||
(c + 1, s + f.size as f64 / (1024 * 1024 * 1024) as f64)
|
||||
});
|
||||
eprintln!(" + add/update file | {add_file_count}x ({add_file_total_size_gib:.1} GiB)");
|
||||
let remove_file_count = changes
|
||||
.iter()
|
||||
.filter(|c| matches!(c, IndexChange::RemoveFile(..)))
|
||||
.count()
|
||||
);
|
||||
eprintln!(
|
||||
" [-] remove directory (and all contents!) | {}x",
|
||||
changes
|
||||
.count();
|
||||
eprintln!(" - remove file | {}x", remove_file_count);
|
||||
let remove_dir_count = changes
|
||||
.iter()
|
||||
.filter(|c| matches!(c, IndexChange::RemoveDir(..)))
|
||||
.count()
|
||||
);
|
||||
.count();
|
||||
eprintln!(" [-] remove directory (and all contents!) | {remove_dir_count}x");
|
||||
// apply changes after confirming
|
||||
if !args.noconfirm {
|
||||
loop {
|
||||
|
Loading…
Reference in New Issue
Block a user