fire-rs

Crates.iofire-rs
lib.rsfire-rs
version0.2.3
sourcesrc
created_at2019-12-09 05:01:57.033775
updated_at2019-12-10 14:17:05.445951
descriptionA Rust implementation of Python-fire
homepage
repositoryhttps://github.com/fun4wut/fire-rs
max_upload_size
id187685
size6,868
(fun4wut)

documentation

https://docs.rs/fire-rs

README

Fire-rs

Use the attribute macro to convert a ordinary function into a command line application (aka cli).

Inspired by Python-fire

Usage

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

TODO

  • Normal args
  • Named args
  • Doc
  • Test
  • Publish to crates.io
  • CI/CD
  • &str problem
  • unused_ warning
  • Default args
  • Multiple functions
  • Deal with errors
Commit count: 18

cargo fmt