use clap_reverse::{AsCommand, ClapReverse};
#[derive(Debug, ClapReverse)]
#[clap_reverse(display, binary = "echo")]
struct Echo {
#[clap_reverse(transparent)]
text: String,
}
fn main() {
let echo = Echo {
text: "Hello, World!".to_string(),
};
println!("Echo structure: {echo:#?}");
println!("Echo command: `{echo}`"); println!("Echo execution result:");
let exit_status = echo.as_command()
.spawn()
.expect("Failed to spawn `echo` command")
.wait()
.expect("Failed to wait on `echo` command");
if !exit_status.success() {
eprintln!("Something went wrong executing `echo` command");
}
}