oxdock-core 0.10.0-alpha

Core engine for OxDock's Dockerfile-inspired compile-time DSL, orchestrating workspace snapshots and asset embedding.
Documentation
/// Macro for defining the command execution pipeline.
///
/// Generates `execute_command(step, cx)` — matches `StepKind` variants and
/// calls the corresponding handler. `lower_command` and `all_metadata` are
/// generated by `declare_commands!` in `oxdock-parser/src/commands.rs`.
///
/// Each entry specifies a pattern (`$pat`) and a handler function with
/// signature `fn(&StepKind, &mut StepCtx<'_, P>) -> Result<()>`.
#[macro_export]
macro_rules! define_pipeline {
    ( $( $variant:pat => $handler:path ),* $(,)? ) => {
        pub fn execute_command<P: $crate::ProcessManager>(
            step: &$crate::StepKind,
            cx: &mut $crate::exec::StepCtx<'_, P>,
        ) -> ::anyhow::Result<()> {
            match step {
                $( $variant => $handler(step, cx), )*
                $crate::StepKind::WithIo { .. } => $crate::exec::dispatch_with_io(step, cx),
                $crate::StepKind::WithIoBlock { .. } => $crate::exec::dispatch_with_io_block(step, cx),
                $crate::StepKind::InheritEnv { .. } => $crate::exec::dispatch_inherit_env(step, cx),
                $crate::StepKind::For { .. } => $crate::exec::dispatch_for_loop(step, cx),
                $crate::StepKind::If { .. } => $crate::exec::dispatch_if_then(step, cx),
                $crate::StepKind::Assign { .. } => $crate::exec::dispatch_assign(step, cx),
            }
        }
    };
}