fui 2.0.0

Add CLI & form interface to your program.
docs.rs failed to build fui-2.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: fui-1.0.1


docs.rs crates.io CI MIT licensed

Add CLI & form interface to your program.

Basic example


fui = "2.0"

Using with clap (experimental)

extern crate clap;
extern crate fui;

use clap::{App, Arg};
use fui::Fui;
use std::env;

// regular clap code
let app = App::new("some-app").arg(

// extra fui code
let mut _arg_vec: Vec<String> = env::args().collect();
if _arg_vec.len() <= 1 {
    _arg_vec = Fui::from(&app).get_cli_input();

// regular clap code
let matches = app.get_matches_from(_arg_vec);


Using without clap

// Example showing imagined CLI app. with two actions

extern crate clap;
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() {
            "help for action1",
            FormView::new().field(Text::new("action1-data").help("help for action1 data")),
            |v| {
                println!("user input (from closure) {:?}", v);
            "help for action2",
            FormView::new().field(Text::new("action2-data").help("help for action2 data")),

This will make the program automatically working in 2 modes:

  1. Ready for parsing CLI arguments, like here:

    $ ./app_basic -h
    app_basic 1.0.0
    xliiv <tymoteusz.jankowski@gmail.com>
    An Example program which has CLI & form interface (TUI)
        app_basic [SUBCOMMAND]
        -h, --help       Prints help information
        -V, --version    Prints version information
        action1    help for action1
        action2    help for action2
        help       Prints this message or the help of the given subcommand(s)
  2. Ready for getting user input from easy and discoverable TUI interface, like image below:

More examples



Clap support

Implemented features

  • switch arguments
  • positional arguments
  • option arguments
  • global arguments
  • subcommands (single level)

To be implemented


  • find a solution for long help messages
  • ctrl+enter submits (#151)
  • handle unwraps


  • .validator(OneOf || Regex::new("v\d+\.\d+\.\d+")).unwrap()?
  • support user's history?
  • checkboxes: automatic toggle on char(+alt)?
  • replace views::Autocomplete & views::Multiselect with a new implementation of Autocomplete