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