Skip to content

IniterWorker/inquire_derive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inquire Derive


Library to support inquire_derive via proc-macro.

Early stage

Supported Widgets

  • Text
  • Select
  • MultiSelect
  • CustomType
  • Editor
  • Password
  • Confirm
  • DateSelect
  • Nested

Inquire Derive in action

Click to show Cargo.toml.
[dependencies]

# The inquire derive crate
inquire = { version = "0.5.2" }
inquire_derive = { git = "https://github.com/IniterWorker/inquire_derive", branch = "master" }

use inquire_derive::InquireForm;

#[derive(Debug, InquireForm)]
pub struct Demo {
    #[inquire(text(
        prompt_message = "\"What's your path?\"",
        initial_value = "\"/my/initial/path\"",
        placeholder_value = "\"/my/placeholder/path\"",
    ))]
    pub path: String,
}

impl Default for Demo {
    fn default() -> Self {
        Self {
            path: "/my/default/path".to_string(),
        }
    }
}

fn main() {
    let mut ex = Demo::default();
    println!("{:?}", ex.inquire_mut().unwrap());
}

Examples

  • Text: cargo run --example text
  • Select: cargo run --example select
  • MultiSelect: cargo run --example multi_select
  • CustomType: cargo run --example custom_type
  • Editor: cargo run --example editor
  • Password: cargo run --example password
  • Confirm: cargo run --example confirm
  • DateSelect: cargo run --example date_select
  • Form(Nested): cargo run --example form

License

See LICENSE for details.

About

Experimental support for inquire derive

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages