oxdock-cli 0.6.0-alpha

CLI tooling for executing OxDock's Docker-inspired language on native platforms.
Documentation
// TODO: Rework this example; it's currently useless

use oxdock_cli::{parse_script, run_script};
use oxdock_fs::GuardedPath;

// Embedded DSL script: builds a small demo tree and drops you into a shell inside it.
const SCRIPT: &str = r#"
# Build a demo tree and explore it interactively.
WORKDIR /
MKDIR demo/assets
MKDIR demo/logs
WRITE demo/assets/hello.txt hello
LS demo
WORKDIR demo
# To drop into the demo workspace after running the script, run this example with
# the CLI `--shell` flag (e.g. `cargo run --example tree_shell -- --shell`).
"#;

fn main() -> anyhow::Result<()> {
    let temp = GuardedPath::tempdir()?;
    let root = temp.as_guarded_path().clone();

    println!("temp workspace: {}", temp.display());
    println!("script:\n{SCRIPT}");
    println!(
        "You'll be dropped into 'demo' inside the temp workspace. Exit the shell to finish the example.\n"
    );

    let steps = parse_script(SCRIPT)?;
    run_script(&root, &steps)
}