diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 0662c98..f4f5b72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use crossterm::{cursor, execute, terminal}; use eyre::{bail, Result}; use regex::Regex; use rustyline::DefaultEditor; @@ -142,6 +143,13 @@ impl Command { exit_status.send(0)?; } + Builtin(Cls) => { + let mut stdout_handle = io::stdout(); + execute!(stdout_handle, terminal::Clear(terminal::ClearType::All))?; + execute!(stdout_handle, cursor::MoveTo(0, 0))?; + exit_status.send(0)?; + } + _ => bail!("Command::run not implemented for {:?}", self), } @@ -226,6 +234,8 @@ impl Command { _ => EchoText { message: args.to_string() }, })), + "CLS" => Ok(Builtin(Cls)), + _ => Err(eyre::eyre!("parse not implemented for {:?}", input)) } |