use anyhow::{Context, bail};
use bookyard_core::BookyardConfig;
pub fn run(title: &str, force: bool) -> anyhow::Result<()> {
let path = crate::commands::config_path()?;
if path.exists() && !force {
bail!(
"{} already exists; pass --force to replace it",
path.display()
);
}
let config = BookyardConfig::new(title);
config
.save_to(&path)
.with_context(|| format!("failed to write {}", path.display()))?;
println!("created {}", path.display());
Ok(())
}