Use the attribute macro to convert a ordinary function into a command line application (aka cli
).
Inspired by Python-fire
```rust use fire_rs::fire;
fn foo(a: i32, b: f64, c: String) {
println!("{} is {}", a as f64 + b, c);
}
fn main() {
foo_fire();
}
``
Run
cargo run -- 1 2.1 coolor
cargo run -- a 1 --b 2.1 --c cool,
the program will output
3.1 is cool`
crates.io
&str
problemunused_
warning