Add CLI & form interface to your program.
Note: Use it at own risk!!
toml
[dependencies]
fui = "0.8"
```rust // Example showing imagined CLI app. with two actions
extern crate fui;
use fui::{Fui, Value}; use fui::form::FormView; use fui::fields::Text;
fn hdlr(v: Value) { println!("user input (from fn) {:?}", v); }
fn main() { Fui::new() .action( "action1", "description", FormView::new().field(Text::new("action1 data").help("help for action1 data")), |v| { println!("user input (from closure) {:?}", v); }, ) .action( "action2", "description", FormView::new().field(Text::new("action2 data").help("help for action2 data")), hdlr, ) .run(); } ```
This will make the program automatically working in 2 modes:
Ready for parsing CLI arguments, like here:
```bash $ ./appbasic -h appbasic 1.0.0 xliiv tymoteusz.jankowski@gmail.com An Example program which has CLI & form interface (TUI)
USAGE: app_basic [SUBCOMMAND]
FLAGS: -h, --help Prints help information -V, --version Prints version information
SUBCOMMANDS: action1 help for action1 action2 help for action2 help Prints this message or the help of the given subcommand(s) ```
or
```bash $ ./appbasic action1 -h appbasic-action1 help for action1
USAGE: app_basic action1 [OPTIONS]
FLAGS: -h, --help Prints help information -V, --version Prints version information
OPTIONS:
--action1-data
Ready for getting user input from easy and discoverable TUI interface, like image below: