use newt_core::agentic::print_newt;
use crate::{render_help_for_tui, VERSION};
pub(crate) fn dispatch(
cmd: &str,
arg1: &str,
workspace: &str,
color: bool,
verbose: bool,
markdown: bool,
) -> anyhow::Result<bool> {
match cmd {
"exit" | "quit" => return Ok(false),
"help" => print!(
"{}",
render_help_for_tui(
None,
color,
verbose,
markdown,
newt_core::tty::term_cols(),
)
),
"version" => print_newt(&format!("v{VERSION}"), color, verbose),
"workspace" => print_newt(workspace, color, verbose),
"config" => match arg1 {
"show" => match crate::migration_notices::read(|report| newt_core::Config::resolve(report)) {
Ok(cfg) => match cfg.to_redacted_toml() {
Ok(toml_str) => {
print_newt("Resolved config (secrets redacted):", color, verbose);
println!("{toml_str}");
}
Err(e) => {
print_newt(&format!("error serializing config: {e}"), color, verbose);
}
},
Err(e) => print_newt(&format!("error resolving config: {e}"), color, verbose),
},
_ => print_newt(
"settings interface not implemented yet — try `/config show` to dump the resolved config",
color,
verbose,
),
},
other => unreachable!("commands::meta::dispatch routed a non-meta command: {other:?}"),
}
Ok(true)
}