mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Rename test module, kinda get connection working.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
use std::io::{Write, stdin, stdout};
|
||||
|
||||
use unshell_test_module::Announcement;
|
||||
|
||||
// use unshell_test_module::ListenerRuntime;
|
||||
|
||||
// fn print_continue_prompt(str: &str) {
|
||||
// printl
|
||||
// }
|
||||
|
||||
fn main() {
|
||||
let mut serverruntime = unshell_test_module::ListenerRuntime::new();
|
||||
|
||||
loop {
|
||||
print!("> ");
|
||||
stdout().flush().expect("Failed to flush stdout");
|
||||
let mut input = String::new();
|
||||
stdin().read_line(&mut input).expect("Failed to read line");
|
||||
let args = input.trim().split(" ").collect::<Vec<&str>>();
|
||||
|
||||
match args[0] {
|
||||
"" => {}
|
||||
"test" => {
|
||||
if let Some(arg) = args.get(1) {
|
||||
println!("Test with argument: {}", arg);
|
||||
serverruntime
|
||||
.send(&Announcement::TestAnnouncement(arg.to_string()))
|
||||
.unwrap();
|
||||
} else {
|
||||
println!("Test without argument");
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
println!("Invalid Command: '{}'", args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// println!("{:?}", args);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user