(server) feat:Add command helper
This commit is contained in:
22
Server/src/command_helper.rs
Normal file
22
Server/src/command_helper.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use std::io::Write;
|
||||
|
||||
pub(crate) fn run() {
|
||||
let stdin = std::io::stdin();
|
||||
|
||||
loop {
|
||||
print!("> ");
|
||||
std::io::stdout()
|
||||
.flush()
|
||||
.expect("Failed to flush standard output!");
|
||||
|
||||
let mut input = String::new();
|
||||
stdin
|
||||
.read_line(&mut input)
|
||||
.expect("Failed to read from standard input!");
|
||||
|
||||
match input.trim() {
|
||||
"exit" => break,
|
||||
_ => println!("Usage: <command>"),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user