fui

docs.rs crates.io Build Status MIT licensed

Add CLI & form interface to your program.

Note: Use it at own risk!!

Basic example

Cargo.toml

toml [dependencies] fui = "0.8"

main.rs

```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:

  1. 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 help for action1 data ```

  2. Ready for getting user input from easy and discoverable TUI interface, like image below:

More examples

Here

Screens

app_basic.rs example

app_ln_like.rs example

app_tar_like.rs example

TODO: