use promptly::{prompt, prompt_default, prompt_opt, Promptable}; use std::error::Error; use std::fmt::Debug; use std::path::PathBuf; fn test(ty: &str, default: P) -> Result<(), Box> { let res = prompt::(ty)?; println!("=> {:?}", res); let res = prompt_opt::(format!("Option<{}>", ty))?; println!("=> {:?}", res); let res = prompt_default::(ty, default)?; println!("=> {:?}", res); Ok(()) } fn main() -> Result<(), Box> { test::("String", "DefaultValue".to_string())?; test::("u32", 0)?; test::("bool", false)?; test::("PathBuf", PathBuf::from("/home"))?; Ok(()) }