Skip to content

fun4wut/fire-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

The Rust implementation on Python-Fire

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages