diff --git a/Server/src/command_helper.rs b/Server/src/command_helper.rs new file mode 100644 index 0000000..21d4084 --- /dev/null +++ b/Server/src/command_helper.rs @@ -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: "), + } + } +} diff --git a/Server/src/main.rs b/Server/src/main.rs index 1d2cf5b..3990150 100644 --- a/Server/src/main.rs +++ b/Server/src/main.rs @@ -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(); }