|
|
|
@ -19,13 +19,15 @@ use std::{
|
|
|
|
|
fn handle_dupe<P>(path: P, mode: &config::Mode) -> Result<(), error::Error>
|
|
|
|
|
where P: AsRef<Path>
|
|
|
|
|
{
|
|
|
|
|
log!(Info, mode.logging_mode => " -> {:?}", path.as_ref());
|
|
|
|
|
match mode.operation_mode
|
|
|
|
|
{
|
|
|
|
|
config::OperationMode::Delete => {
|
|
|
|
|
log!(Info, mode.logging_mode => " -> {:?}", path.as_ref());
|
|
|
|
|
mode.error_mode.handle(std::fs::remove_file(path.as_ref()))?;
|
|
|
|
|
},
|
|
|
|
|
_ => (),
|
|
|
|
|
config::OperationMode::Print => {
|
|
|
|
|
println!(" -> {:?}", path.as_ref());
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
@ -36,13 +38,15 @@ where P: AsRef<Path>
|
|
|
|
|
async fn handle_dupe_async<P>(path: P, mode: &config::Mode) -> Result<(), error::Error>
|
|
|
|
|
where P: AsRef<Path>
|
|
|
|
|
{
|
|
|
|
|
log!(Info, mode.logging_mode => " -> {:?}", path.as_ref());
|
|
|
|
|
match mode.operation_mode
|
|
|
|
|
{
|
|
|
|
|
config::OperationMode::Delete => {
|
|
|
|
|
log!(Info, mode.logging_mode => " -> {:?}", path.as_ref());
|
|
|
|
|
mode.error_mode.handle(tokio::fs::remove_file(path.as_ref()).await)?;
|
|
|
|
|
},
|
|
|
|
|
_ => (),
|
|
|
|
|
config::OperationMode::Print => {
|
|
|
|
|
println!(" -> {:?}", path.as_ref());
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|