(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>"),
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
mod command_helper;
|
||||
mod server_logger;
|
||||
|
||||
use server_logger::ServerLogger;
|
||||
@ -8,4 +9,6 @@ fn main() {
|
||||
log::info!("Starting server...");
|
||||
|
||||
log::info!("Server successfully started!");
|
||||
|
||||
command_helper::run();
|
||||
}
|
||||
|
Reference in New Issue
Block a user