mirror of
https://github.com/veeso/termscp.git
synced 2026-07-16 13:03:49 +02:00
13 lines
371 B
Rust
13 lines
371 B
Rust
//! ## Utils
|
|
//!
|
|
//! `Utils` implements utilities functions to work with layouts
|
|
|
|
/// Read a secret from tty with customisable prompt
|
|
pub fn read_secret_from_tty(prompt: &str) -> std::io::Result<Option<String>> {
|
|
match rpassword::prompt_password(prompt) {
|
|
Ok(p) if p.is_empty() => Ok(None),
|
|
Ok(p) => Ok(Some(p)),
|
|
Err(err) => Err(err),
|
|
}
|
|
}
|