23 lines
488 B
Rust
23 lines
488 B
Rust
![]() |
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>"),
|
||
|
}
|
||
|
}
|
||
|
}
|