Skip to content

Commit 0674960

Browse files
committed
feat: hash progress
1 parent db633e0 commit 0674960

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ fn main() -> Result<()> {
164164

165165
tracing::info!("Copy completed successfully in {:?}.", start_time.elapsed());
166166

167+
let hash_progress_cb = |info | {
168+
match info {
169+
file_hashing::ProgressInfo::Yield(p) => {
170+
tracing::info!("Hashing... ({}%)", p);
171+
},
172+
file_hashing::ProgressInfo::Error(error) => {
173+
panic!("Failed to hash file: {:?}", error)
174+
}
175+
}
176+
};
177+
167178
if args.verify {
168179
tracing::info!("Computing hash...");
169180
let mut source_hash = Blake2s256::new();
@@ -174,7 +185,7 @@ fn main() -> Result<()> {
174185
destination_path,
175186
&mut dst_hash,
176187
num_cpus::get(),
177-
|_| {},
188+
hash_progress_cb
178189
)?;
179190
} else {
180191
file_hashing::get_hash_file(source_path, &mut source_hash)?;

0 commit comments

Comments
 (0)