Rust Fire
Turn your function(s) to a command line app. Inspires by Google's Python Fire.
Installation
Usage
// Turn a single function to CLI app.
// Turn mutilple functions to CLI app.
Now you can run your CLI app. By default the single function welcome
should be called:
The funtions in the mod should be called as sub-command with it's function name:
Funtions with arguments will receive the arguments from CLI app arguments, with format like --argname=argvalue
:
Fire will call .parse()
on every argument (except &str
), so all types which implements FromStr plus &str
is supported. For optional argument, you can use the Option
generic type, like Option<String>
or Option<i32>
;
License
Licensed under the BSD License.