use oxdock_cli::{parse_script, run_script};
use oxdock_fs::GuardedPath;
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)
}