Macro cmd_lib::use_custom_cmd [−][src]
use_custom_cmd!() { /* proc-macro */ }
Expand description
import user registered custom command
#[export_cmd(my_cmd)]
fn foo(env: &mut CmdEnv) -> CmdResult {
let msg = format!("msg from foo(), args: {:?}\n", env.args());
writeln!(env.stderr(), "{}", msg)?;
writeln!(env.stdout(), "bar")
}
use_custom_cmd!(my_cmd);
run_cmd!(my_cmd)?;
Here we import the previous defined my_cmd
command, so we can run it like a normal command.