Attribute Macro cmd_lib_macros::export_cmd [−][src]
#[export_cmd]
export the function as an command to be run by run_cmd!
or run_fun!
#[export_cmd(my_cmd)] fn foo(args: CmdArgs, _envs: CmdEnvs) -> FunResult { println!("msg from foo(), args: {:?}", args); Ok("bar".into()) } use_custom_cmd!(my_cmd); run_cmd!(my_cmd)?; println!("get result: {}", run_fun!(my_cmd)?);
Here we export function foo
as my_cmd
command.