2025-05-02 20:35:45 +02:00
|
|
|
use osdb::branding::startup_msg;
|
|
|
|
|
use osdb::cli::read_input;
|
|
|
|
|
use osdb::command::Command;
|
2025-05-03 18:39:36 +02:00
|
|
|
use osdb::error_display::OSDBError as _;
|
2025-05-01 22:19:24 +02:00
|
|
|
|
2025-05-01 19:24:18 +02:00
|
|
|
fn main() {
|
2025-05-03 19:00:41 +02:00
|
|
|
println!("{}", startup_msg());
|
2025-05-01 21:00:28 +02:00
|
|
|
while let Some(input) = read_input() {
|
2025-05-02 20:53:12 +02:00
|
|
|
match input.parse::<Command>() {
|
|
|
|
|
Ok(cmd) => {
|
2025-05-03 19:21:05 +02:00
|
|
|
let result = cmd.execute();
|
|
|
|
|
println!("{}", result.display());
|
|
|
|
|
if result.should_exit {
|
2025-05-02 20:53:12 +02:00
|
|
|
break;
|
2025-05-02 20:46:08 +02:00
|
|
|
}
|
2025-05-02 20:53:12 +02:00
|
|
|
}
|
2025-05-03 21:29:40 +02:00
|
|
|
Err(err) => err.display("<stdin>", &input),
|
2025-05-01 21:00:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
2025-05-03 19:06:59 +02:00
|
|
|
println!("Good-bye");
|
2025-05-01 21:00:28 +02:00
|
|
|
}
|