use std::collections::HashMap;
use crate::shellrun::quote;
fn claude(args: Option<&str>, values: Option<&HashMap<String, String>>) -> String {
let mut command = String::from("claude");
if let Some(args) = args
&& !args.is_empty()
{
command = format!("{command} {args}");
}
match values {
None => command.push_str(" --continue"),
Some(values) => {
if let Some(prompt) = values.get("prompt") {
command = format!("{command} {}", quote(prompt));
}
}
}
format!(
"sh -c {}",
quote(&format!("ctx builtin claude trust; exec {command}"))
)
}
pub const PANE_BUILTINS: &[&str] = &["claude"];
pub fn builtin_keys(name: &str) -> &'static [&'static str] {
match name {
"claude" => &["prompt"],
_ => &[],
}
}
pub fn builtin_command(
name: &str,
args: Option<&str>,
values: Option<&HashMap<String, String>>,
) -> String {
match name {
"claude" => claude(args, values),
_ => unreachable!("unknown builtin '{name}' survived layout parsing"),
}
}