use newt_core::Config;
use std::path::Path;
pub fn run(config_path: Option<&Path>) -> anyhow::Result<()> {
let mut config = match config_path {
Some(p) => Config::load(p)?,
None => Config::resolve()?,
};
let tui = config.tui.get_or_insert_with(Default::default);
if tui.prompt.is_none() {
tui.prompt = Some(newt_tui::DEFAULT_RICH_PROMPT.to_string());
}
println!("# Resolved Newt configuration (Config::resolve() search order; secrets redacted)");
println!("#");
println!("# [tui] edit_mode = \"emacs\" | \"vi\" (shipped default: emacs)");
println!("# [tui] footer = \"auto\" | \"on\" | \"off\" (auto = rich prompt on a TTY)");
println!("#");
println!("# [tui] prompt — customize with these tokens (or run `/prompt` in a session).");
println!("# Prefer the $NAME macros here: TOML eats backslashes, so the \\x forms need");
println!("# a 'literal string' (single quotes) or doubled \\\\ (e.g. \"\\\\t\").");
for (name, slash, desc) in newt_tui::PROMPT_TOKENS {
if slash.is_empty() {
println!("# {name:<11} {desc}");
} else {
println!("# {name:<11} {slash:<3} {desc}");
}
}
println!();
let toml_str = config.to_redacted_toml()?;
println!("{toml_str}");
Ok(())
}