pub(crate) mod actions; mod config; mod rust_action; use std::{ops::Deref, sync::Arc}; use catalog::RustAction; pub use config::ActionConfig; use semver::Version; pub mod catalog { pub use crate::rust_action::*; } pub struct Action(Arc); impl Deref for Action { type Target = Arc; fn deref(&self) -> &Self::Target { &self.0 } } pub struct Actions(Vec); impl Actions { pub fn from_cuddle() -> anyhow::Result { let config = ActionConfig::parse()?; Ok(Self( vec![Action(Arc::new(RustAction::new()))] .into_iter() .filter(|a| a.enabled(&config).unwrap_or_default()) .collect(), )) } pub fn execute(&self, version: &Version) -> anyhow::Result<()> { for action in &self.0 { action.execute(version)?; } Ok(()) } }