You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to easily annotate a configuration struct, to ask the user for input for various fields and give a hint on validation:
use inquire::AskUser;#[derive(Debug,AskUser)]structMyConf{#[ask(q="Please enter password:", hide_input=true, min_len=12)]password:Option<String>,#[ask(q="Please enter username:", min_len=3)]username:Option<String>,#[ask(q="Please enter age:", range=18..=85)]age:Option<u8>,}fnmain() -> Result<()>{letmut conf = MyConf::default()
conf.password()?.validate()?;
conf.username()?.validate()?;
conf.age()?.validate()?;println!("{conf#?}");}
I would be interested if something like this is already existing, e.g. based on inquire, or if there is any interest to add this?
The text was updated successfully, but these errors were encountered:
I would like to easily annotate a configuration struct, to ask the user for input for various fields and give a hint on validation:
I would be interested if something like this is already existing, e.g. based on inquire, or if there is any interest to add this?
The text was updated successfully, but these errors were encountered: