shitbox/corebox/commands/clear/mod.rs
Nathan Fisher 06b88d2c24 Refactoring:
- Split into workspace crates
- Split into two binaries `corebox` and `hashbox`
- Add `mount` crate to workspace to prepare for third binary `utilbox`
2023-02-05 23:50:59 -05:00

25 lines
574 B
Rust

use super::Cmd;
use clap::Command;
#[derive(Debug, Default)]
pub struct Clear;
impl Cmd for Clear {
fn cli(&self) -> Command {
Command::new("clear")
.about("clear the terminal's screen")
.author("Nathan Fisher")
.version(env!("CARGO_PKG_VERSION"))
}
fn run(&self, _matches: &clap::ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
print!("\x1b[2J\x1b[H");
print!("\x1b[3J\x1b[H");
Ok(())
}
fn path(&self) -> Option<shitbox::Path> {
Some(shitbox::Path::UsrBin)
}
}