use super::{Error, Fx, Outcome};
use crate::prompt::tool::builtin;
#[derive(clap::Args, Debug)]
pub struct Args {
#[arg(help = name_help())]
pub name: String,
}
fn name_help() -> String {
format!("Built-in tool to run; one of: {}", builtin::pool())
}
pub fn run(args: Args, fx: &mut Fx) -> Result<Outcome, Error> {
let code = builtin::run(
&args.name,
&fx.driver_target,
&mut fx.tool_stdin,
&mut fx.tool_stdout,
&mut fx.tool_stderr,
)
.map_err(|e| Error::new(format!("tool {}", args.name), e))?;
Ok(Outcome::Code(code as u8))
}