use betamax_core::ghostty::theme_names;
use clap::Parser;
use miette::{IntoDiagnostic, Result};
#[derive(Debug, Parser)]
pub struct ListThemes {
#[arg(long)]
markdown: bool,
#[arg(long)]
json: bool,
}
impl ListThemes {
pub fn run(&self) -> Result<()> {
let themes = theme_names()?;
if self.json {
println!(
"{}",
serde_json::to_string_pretty(&themes).into_diagnostic()?
);
return Ok(());
}
let (prefix, suffix) = if self.markdown {
("* `", "`")
} else {
("", "")
};
for theme in themes {
println!("{prefix}{theme}{suffix}");
}
Ok(())
}
}