admin: input password on the same line

This commit is contained in:
Denis Drakhnia 2024-06-05 16:00:55 +03:00
parent 827c37b765
commit 9d43ac5141

View File

@ -3,7 +3,7 @@
mod cli;
use std::io;
use std::io::{self, Write};
use std::net::UdpSocket;
use blake2b_simd::Params;
@ -24,7 +24,8 @@ fn read_password() -> Result<Option<String>, Error> {
use crossterm::event::{read, Event, KeyCode, KeyEventKind, KeyModifiers};
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
println!("Password:");
print!("Password: ");
io::stdout().flush().unwrap();
enable_raw_mode()?;
@ -64,6 +65,8 @@ fn read_password() -> Result<Option<String>, Error> {
disable_raw_mode()?;
println!();
Ok(match buf.len() {
0 => None,
_ => Some(buf),