2023-01-07 18:30:22 -05:00
|
|
|
use super::Cmd;
|
|
|
|
use clap::{Arg, Command};
|
|
|
|
|
2023-01-13 01:08:32 -05:00
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct Yes;
|
2023-01-07 18:30:22 -05:00
|
|
|
|
|
|
|
impl Cmd for Yes {
|
|
|
|
fn cli(&self) -> clap::Command {
|
2023-01-13 01:08:32 -05:00
|
|
|
Command::new("yes")
|
2023-01-07 18:30:22 -05:00
|
|
|
.about("output a string repeatedly until killed")
|
|
|
|
.author("Nathan Fisher")
|
|
|
|
.arg(Arg::new("msg").num_args(1).default_value("y"))
|
|
|
|
}
|
|
|
|
|
2023-02-04 08:54:27 -05:00
|
|
|
fn run(&self, matches: &clap::ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
|
2023-01-07 18:30:22 -05:00
|
|
|
let msg = matches.get_one::<String>("msg").unwrap();
|
|
|
|
loop {
|
|
|
|
println!("{msg}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-05 23:50:59 -05:00
|
|
|
fn path(&self) -> Option<shitbox::Path> {
|
|
|
|
Some(shitbox::Path::UsrBin)
|
2023-01-07 18:30:22 -05:00
|
|
|
}
|
|
|
|
}
|