♻️ refactor(cli): extract action execution to separate function

- move action execution logic into its own function
- improve readability and maintainability
This commit is contained in:
Jeremiah Russell
2025-10-11 09:30:29 +01:00
committed by Jeremiah Russell
parent d951826c51
commit 2110d56331

View File

@@ -30,11 +30,18 @@ impl RunCli {
continue;
};
self.execute_action(processor, action, &label).await;
}
Ok(())
}
async fn execute_action<'a>(&self, processor: Processor<'a>, action: EolAction, label: &str) {
match action {
EolAction::Trash => {
if !self.skip_trash {
log::info!("trashing older messages");
match processor.trash_messages(&label).await {
match processor.trash_messages(label).await {
Ok(_) => {}
Err(e) => {
log::warn!("action failed for label {label} with error {e}");
@@ -47,7 +54,7 @@ impl RunCli {
EolAction::Delete => {
if !self.skip_delete {
log::info!("deleting older messages");
match processor.delete_messages(&label).await {
match processor.delete_messages(label).await {
Ok(_) => {}
Err(e) => {
log::warn!("action failed for label {label} with error {e}");
@@ -59,7 +66,4 @@ impl RunCli {
}
}
}
Ok(())
}
}