(server) feat:Add command helper

This commit is contained in:
CaicukunChiji
2025-07-10 18:26:15 +08:00
parent 475b206cf9
commit 243a1cb923
2 changed files with 25 additions and 0 deletions

View 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>"),
}
}
}

View File

@ -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();
}