Rust_cmd_lib v0.10: to write shell-script like tasks in a clean, natural and rusty way

Thanks to the better stable proc-macro ecosystem and std::process APIs, I can make several improvements for this rust_cmd_lib library:

  1. automatic variable substitution:
let msg = "I love rust";
run_cmd!(echo "This is the message: $msg")?;
run_cmd!(du -ah . | sort -hr | head -n 10)?;
  1. custom command registration:
#[export_cmd(my_cmd)]
fn foo(args: CmdArgs, _envs: CmdEnvs) -> FunResult {
    println!("msg from foo(), args: {:?}", args);
    Ok("bar".into())
}
// to use it
use_cmd!(my_cmd);
run_cmd!(my_cmd)?;
  1. bunch of code clean up

Any feedback is very welcome!

1 Like