mirror of
https://git.mentality.rip/numas13/xash3d-master.git
synced 2025-03-10 04:31:10 +00:00
admin: input password on the same line
This commit is contained in:
parent
827c37b765
commit
9d43ac5141
@ -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…
x
Reference in New Issue
Block a user