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