Files
agent-manager/src/commands/theme_cmd.rs
T
bruno 890ad953e5 feat: phase 2 quick wins (#65 #69 #72)
- #65: update policies + per-agent version pinning
  - add settings.update_policy (stable/latest/skip)
  - add AgentDef.pin_version
  - honor both in update_cmd
  - add update_policy tests

- #69: REPL color theme CLI command
  - add am theme [name] (show/switch)
  - persist selected theme to config

- #72: doctor checks local model runtimes
  - verify ollama and llama-server on PATH
  - for ollama, also check server responds (ollama ls)

Version 0.4.4
2026-08-17 22:24:45 -04:00

42 lines
1.3 KiB
Rust

//! theme: switch the active color theme and persist it for the next start.
//!
//! With no argument, prints the current theme and the available list.
//! With a name, switches to that theme (also used by the REPL 'theme' command).
use super::*;
use crate::theme;
pub fn run(app: &App, name: Option<&str>) -> Result<i32> {
if let Some(name) = name {
let theme = theme::find(name).ok_or_else(|| {
anyhow::anyhow!(
"unknown theme '{name}' — available: {}",
theme::names().join(", ")
)
})?;
app.set_theme(theme);
crate::commands::config_cmd::persist_setting(app, "settings.theme", theme.name)?;
app.log.success(&format!(
"theme set to {} ({})",
theme.name,
theme.title
));
return Ok(0);
}
// No argument: show current and list.
let current = app.theme();
if app.json() {
crate::output::print_json(&serde_json::json!({
"current": current.name,
"title": current.title,
"available": theme::names(),
}));
} else {
println!("current theme: {} — {}", current.name, current.title);
println!("available themes: {}", theme::names().join(", "));
println!("use 'am theme <name>' to switch");
}
Ok(0)
}