Browse Source

admin: input password on the same line

ipv6
Denis Drakhnia 6 months ago
parent
commit
9d43ac5141
  1. 7
      admin/src/main.rs

7
admin/src/main.rs

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

Loading…
Cancel
Save