use xshell::{cmd, read_file};
let name = "Julia";
let output = cmd!("echo hello {name}!").read()?;
assert_eq!(output, "hello Julia!");
let err = read_file("feeling-lucky.txt").unwrap_err();
assert_eq!(
err.to_string(),
"`feeling-lucky.txt`: no such file or directory (os error 2)",
);
I like the idea That is, something like ::duct was already quite nice, except for it bundling dependencies: given the purpose of using it for scripts / ad-hoc (compile-&-run) programs, both a certain amount of ergonomics and a lack of dependencies / fast from-scratch compile-times are paramount in order to minimize the impact on dev-time
scriptisto, cargo-script, or even this hack would be great companions to this crate for creating scripts with Rust. They make it possible to create single-file Rust scripts that are re-compiled as needed.