Interactive Prompts
User-friendly prompts for input, confirmation, and selection
Confirmation Prompt
Ask yes/no questions
Confirmation Example
use zfish::Prompt;
// Prompt for yes/no confirmation
// Second parameter is default value
let answer = Prompt::confirm("Do you want to continue?", true)?;
if answer {
println!("Continuing...");
} else {
println!("Aborted.");
}Output
Do you want to continue? [Y/n] y\nContinuing...
Text Input
Get text input from users
Input Example
use zfish::Prompt;
// Prompt for text input
let name = Prompt::input("What is your name?")?;
println!("Hello, {}!", name);
// Alternative: Prompt::text() (alias for input)
let lang = Prompt::text("Favorite language?")?;
println!("You chose: {}", lang);Output
What is your name? John Doe\nHello, John Doe!\nFavorite language? Rust\nYou chose: Rust
Password Input
Securely collect password input (hidden)
Password Example
use zfish::Prompt;
// Prompt for password with hidden input
let password = Prompt::password("Enter password:")?;
println!("ā Password accepted (hidden)");
// Password input is not echoed to terminal
// The input is completely hidden for securityOutput
Enter password: \nā Password accepted (hidden)