Crate fui [−] [src]
fui
lets you build a form based user interfaces for a CLI program.
Examples
Cargo.toml
[dependencies]
fui = "0.8"
main.rs
extern crate fui;
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(); }
More examples
Description
If you look at the example above you'll notice a few entities:
These components will be most frequently used building blocks, especially FormView and fields.
Here's the logic behind those components:
- Fui is a struct which gathers your program
action
s action
s are things which program does (like,git pull
,git push
, etc.)action
includes:
Flow:
- user picks
action
(thenform
is shown) - user submit
form
withdata
handler
is called withdata
(point 2)
Modules
cursive |
Re-export of Cursive crate. |
feeders |
Data providers for |
fields |
Includes |
form |
Contains |
utils |
Various kinds of helpers. |
validators |
Provides data validators used by |
views |
Contains views which are building blocks for |
Structs
Fui |
Top level building block of |
Enums
Value |
Represents any valid JSON value. |