1use clap::Parser;
2use rustutils_runnable::Runnable;
3use std::error::Error;
4use std::io::{stdout, BufWriter, Write};
5
6#[derive(Parser, Clone, Debug)]
8#[clap(author, version, about, long_about = None)]
9pub struct Yes {
10 #[clap(default_value = "y")]
12 string: Vec<String>,
13}
14
15impl Runnable for Yes {
16 fn run(&self) -> Result<(), Box<dyn Error>> {
17 let mut string = self.string.join(" ");
18 string.push('\n');
19 let mut stdout = BufWriter::new(stdout());
20 loop {
21 stdout.write_all(&string.as_bytes())?;
22 }
23 }
24}