xbp 10.14.2

XBP is a zero-config build pack that can also interact with proxies, kafka, sockets, synthetic monitors.
Documentation
use std::io::{self, Write};

use rpassword;
use tracing::info;

/// Ask the user for text input and return the trimmed result.
pub fn prompt_for_input(prompt: &str) -> Result<String, String> {
    info!("{}", prompt);
    io::stdout()
        .flush()
        .map_err(|e| format!("Failed to flush stdout: {}", e))?;

    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .map_err(|e| format!("Failed to read input: {}", e))?;

    Ok(input.trim().to_string())
}

/// Ask the user for a password without echoing.
pub fn prompt_for_password(prompt: &str) -> Result<String, String> {
    rpassword::prompt_password(prompt).map_err(|e| format!("Failed to read password: {}", e))
}