diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 9d8ed49..0000000 --- a/src/main.rs +++ /dev/null @@ -1,65 +0,0 @@ -#![forbid(unsafe_code)] -use crate::result::Result; -use crate::terminal::{Input, Terminal}; - -use std::process; -use tokio::io::{self, AsyncWriteExt}; - -pub mod error; -pub mod result; -pub mod terminal; - - -#[tokio::main] -async fn main() -> Result<()> { - let result = repl().await; - process::exit(match result { - Ok(()) => 0, - Err(ref e) => { - eprintln!("{}", e); - 1 - } - }) -} - - -async fn repl() -> Result<()> { - println!("Hello, terminal!"); - - let mut terminal = Terminal::init(io::stdin())?; - - loop { - prompt().await?; - - let input = terminal.handle_input().await?; - - match input { - Input::String(string) => { - println!("{:?} {}", string, string.len()); - execute(&string).await? - }, - Input::End => break, - } - - break; - } - - terminal.cleanup()?; - - Ok(()) -} - - -async fn prompt() -> Result<()> { - let mut stdout = io::stdout(); - stdout.write_all("\n$ ".as_bytes()).await?; - stdout.flush().await?; - - Ok(()) -} - - -async fn execute(_input: &str) -> Result<()> { - Ok(()) -} - |