4 stable releases
2.0.0 | Apr 3, 2024 |
---|---|
1.2.0 | Mar 26, 2024 |
1.1.0 | Mar 25, 2024 |
1.0.0 | Mar 25, 2024 |
#534 in Rust patterns
535 downloads per month
Used in system-harness
8KB
80 lines
cmdstruct
A lightweight macro for implementing commands with a struct
Usage
use cmdstruct::Command;
#[derive(Command)]
#[command(executable = "echo")]
struct Echo {
/// Flag to provide
#[arg(flag = "-n")]
no_new_line: bool,
/// String to echo
#[arg]
s: String
}
fn main() {
let echo = Echo {
no_new_line: true,
s: "hello world".to_string()
};
echo.command().spawn();
}
Dependencies
~0.4–0.8MB
~20K SLoC