read_password

Function read_password 

Source
pub fn read_password(
    prompt: &str,
    password_override: Option<&str>,
    use_askpass: bool,
) -> Result<String>
Expand description

Reads a password either from the provided argument, via the system’s askpass tool when enabled, or interactively via rpassword.

§Arguments

  • prompt - The prompt to show the user.
  • password - An optional password string.
  • use_askpass - Boolean flag to indicate if the system’s askpass should be used.

§Returns

A Result wrapping the password string. Ask the user for a password, honoring explicit overrides, graphical helpers, and finally falling back to a plain TTY prompt.