Crates.io | fire-rs |
lib.rs | fire-rs |
version | 0.2.3 |
source | src |
created_at | 2019-12-09 05:01:57.033775 |
updated_at | 2019-12-10 14:17:05.445951 |
description | A Rust implementation of Python-fire |
homepage | |
repository | https://github.com/fun4wut/fire-rs |
max_upload_size | |
id | 187685 |
size | 6,868 |
Use the attribute macro to convert a ordinary function into a command line application (aka cli
).
Inspired by Python-fire
use fire_rs::fire;
#[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 cool
or cargo run -- a 1 --b 2.1 --c cool
,
the program will output 3.1 is cool
crates.io
&str
problemunused_
warning