mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 20:47:13 +08:00
(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