use bookyard_core::{BuildOptions, build_shelf};

pub fn run(no_mdbook: bool) -> anyhow::Result<()> {
    let root = crate::commands::root_dir()?;
    let config = crate::commands::load_config()?;
    let plan = build_shelf(
        &root,
        &config,
        &BuildOptions {
            run_mdbook: !no_mdbook,
        },
    )?;
    crate::render::shelf::write_shelf(&plan.output_dir, &config)?;
    println!("built {}", plan.output_dir.display());
    Ok(())
}
