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 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 {
|
|
|
|
|
chainload::chainload(context, chainload);
|
2025-10-05 00:09:53 -07:00
|
|
|
} else if let Some(print) = &action.print {
|
|
|
|
|
print::print(context, print);
|
2025-10-04 23:12:01 -07:00
|
|
|
} else {
|
|
|
|
|
panic!("unknown action configuration");
|
|
|
|
|
}
|
|
|
|
|
}
|