2025-10-04 23:12:01 -07:00
|
|
|
use crate::context::Context;
|
|
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
|
|
pub mod chainload;
|
2025-10-05 00:09:53 -07:00
|
|
|
pub mod print;
|
2025-10-04 23:12:01 -07:00
|
|
|
|
2025-10-05 03:12:00 -07:00
|
|
|
#[cfg(feature = "splash")]
|
|
|
|
|
pub mod splash;
|
|
|
|
|
|
2025-10-05 00:09:53 -07:00
|
|
|
pub fn execute(context: Rc<Context>, name: impl AsRef<str>) {
|
|
|
|
|
let Some(action) = context.root().actions().get(name.as_ref()) else {
|
|
|
|
|
panic!("unknown action: {}", name.as_ref());
|
|
|
|
|
};
|
2025-10-04 23:12:01 -07:00
|
|
|
let context = context.finalize().freeze();
|
|
|
|
|
|
|
|
|
|
if let Some(chainload) = &action.chainload {
|
2025-10-05 03:12:00 -07:00
|
|
|
chainload::chainload(context.clone(), chainload);
|
|
|
|
|
return;
|
2025-10-05 00:09:53 -07:00
|
|
|
} else if let Some(print) = &action.print {
|
2025-10-05 03:12:00 -07:00
|
|
|
print::print(context.clone(), print);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "splash")]
|
|
|
|
|
if let Some(splash) = &action.splash {
|
|
|
|
|
splash::splash(context.clone(), splash);
|
|
|
|
|
return;
|
2025-10-04 23:12:01 -07:00
|
|
|
}
|
2025-10-05 03:12:00 -07:00
|
|
|
|
|
|
|
|
panic!("unknown action configuration");
|
2025-10-04 23:12:01 -07:00
|
|
|
}
|