shitbox/corebox/commands/yes/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

26 lines
645 B
Rust

use super::Cmd;
use clap::{Arg, Command};
#[derive(Debug, Default)]
pub struct Yes;
impl Cmd for Yes {
fn cli(&self) -> clap::Command {
Command::new("yes")
.about("output a string repeatedly until killed")
.author("Nathan Fisher")
.arg(Arg::new("msg").num_args(1).default_value("y"))
}
fn run(&self, matches: &clap::ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
let msg = matches.get_one::<String>("msg").unwrap();
loop {
println!("{msg}");
}
}
fn path(&self) -> Option<shitbox::Path> {
Some(shitbox::Path::UsrBin)
}
}