Skip to content
/ fui Public

Add form interface to your CLI program.

License

Notifications You must be signed in to change notification settings

pashh/fui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fui

docs.rs crates.io Build Status MIT licensed

Add form interface to your CLI program.

Note: Use it at own risk!!

Basic example

Cargo.toml

[dependencies]
fui = "0.7"

main.rs

// 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 hdlr) {:?}", 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 callback) {:?}", v);
            },
        )
        .action(
            "ACTION2: description",
            FormView::new().field(Text::new("action2 data").help("help for action2 data")),
            hdlr,
        )
        .run();
}

More examples

Here

Screens

app_basic.rs example app_ln_like.rs example app_tar_like.rs example

TODO:

  • select in autocomplete load values while scrolling
  • support user's history!
    • make fill-error-correct flow pleasent
  • support for piping!
  • create wrapper FileField
  • create wrapper DirField
  • ctrl+enter submits (#151)?
  • checkbox: automatic toggle on char
  • add Field.data & form on_submit returns it?
  • optimalizations
    • feeders use iterators
    • thread
  • tests
  • error handling & unwraps
  • magic stuff:
    • add magic which renders form for clap (or structopt) if args missing
    • add magic which works with current programs like: ls, grep, etc.

About

Add form interface to your CLI program.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages