All Projects → xliiv → Fui

xliiv / Fui

Licence: mit
Add CLI & form interface to your program. Docs: https://docs.rs/fui

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Fui

Nnn
n³ The unorthodox terminal file manager
Stars: ✭ 13,138 (+5284.43%)
Mutual labels:  cli, ncurses, tui
Goaccess
GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
Stars: ✭ 14,096 (+5677.05%)
Mutual labels:  cli, tui, ncurses
Mandown
man-page inspired Markdown viewer
Stars: ✭ 173 (-29.1%)
Mutual labels:  cli, tui, ncurses
Neix
neix - a RSS/Atom feed reader for your terminal.
Stars: ✭ 128 (-47.54%)
Mutual labels:  cli, tui, ncurses
React Redux Form
Create forms easily in React with Redux.
Stars: ✭ 2,099 (+760.25%)
Mutual labels:  form, forms
Form bloc
🔥 Dart and Flutter Package 🔥 Easy Form State Management using BLoC pattern 🔥 Wizard/stepper forms, asynchronous validation, dynamic and conditional fields, submission progress, serialization and more! 🔥
Stars: ✭ 239 (-2.05%)
Mutual labels:  form, forms
React Form
⚛️ Hooks for managing form state and validation in React
Stars: ✭ 2,270 (+830.33%)
Mutual labels:  form, forms
Cursive
A Text User Interface library for the Rust programming language
Stars: ✭ 2,613 (+970.9%)
Mutual labels:  tui, ncurses
Discordrpcmaker
Cross-platform Discord Rich Presence Maker, WITH BUTTONS!
Stars: ✭ 165 (-32.38%)
Mutual labels:  cli, tui
Redux Form
A Higher Order Component using react-redux to keep form state in a Redux store
Stars: ✭ 12,597 (+5062.7%)
Mutual labels:  form, forms
Awesome Finder
😎 Search the awesome curated list without browser
Stars: ✭ 194 (-20.49%)
Mutual labels:  cli, tui
Composable Form
Build type-safe composable forms in Elm
Stars: ✭ 179 (-26.64%)
Mutual labels:  form, forms
React Apollo Form
Build React forms based on GraphQL APIs.
Stars: ✭ 178 (-27.05%)
Mutual labels:  form, forms
Neomutt
✉️ Teaching an Old Dog New Tricks -- IRC: #neomutt on irc.libera.chat
Stars: ✭ 2,343 (+860.25%)
Mutual labels:  cli, ncurses
Cuishark
A protocol analyzer like a wireshark on CUI. cuishark is using libwireshark to analyze packets. https://cuishark.slankdev.net
Stars: ✭ 208 (-14.75%)
Mutual labels:  tui, ncurses
Qrc
QR code generator for text terminals (ASCII art, Sixel)
Stars: ✭ 200 (-18.03%)
Mutual labels:  cli, tui
Jquery.terminal
jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands
Stars: ✭ 2,623 (+975%)
Mutual labels:  cli, tui
Tmux Fzf Url
🚀 Quickly open urls on your terminal screen!
Stars: ✭ 227 (-6.97%)
Mutual labels:  cli, tui
Cistern
A terminal UI for Unix to monitor Continuous Integration pipelines from the command line. Current integrations include GitLab, Azure DevOps, Travis CI, AppVeyor and CircleCI.
Stars: ✭ 161 (-34.02%)
Mutual labels:  cli, tui
Tuicss
Text-based user interface CSS library
Stars: ✭ 167 (-31.56%)
Mutual labels:  tui, ncurses

fui

docs.rs crates.io CI MIT licensed

Add CLI & form interface to your program.

Basic example

cargo.toml

[dependencies]
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(
    Arg::with_name("some-switch")
        .long("arg-long")
        .help("arg-help"),
);


// 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);

asciicast

Using without clap

// Example showing imagined CLI app. with two actions

#[macro_use]
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() {
    Fui::new(crate_name!())
        .action(
            "action1",
            "help for action1",
            FormView::new().field(Text::new("action1-data").help("help for action1 data")),
            |v| {
                println!("user input (from closure) {:?}", v);
            },
        )
        .action(
            "action2",
            "help for action2",
            FormView::new().field(Text::new("action2-data").help("help for action2 data")),
            hdlr,
        )
        .version(crate_version!())
        .about(crate_description!())
        .author(crate_authors!())
        .run();
}

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 <[email protected]>
    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)
    
  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

Clap support

Implemented features

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

To be implemented

TODO

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

Ideas

  • .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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].