diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index b40b9ca..f5f96b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,21 @@ -fn main() { - print!(">"); +use std::error::Error; +use std::{io, io::Write}; + +fn prompt() -> Result<(), Box<dyn Error>> { + print!("> "); + io::stdout().flush()?; + Ok(()) +} + +fn read_stdin() -> Result<String, Box<dyn Error>> { + let mut buffer = String::new(); + io::stdin().read_line(&mut buffer)?; + Ok(buffer) +} + +fn main() -> Result<(), Box<dyn Error>> { + loop { + prompt()?; + let _user_input = read_stdin()?; + } } |