use bookyard_core::detect_book_source;

pub fn run() -> anyhow::Result<()> {
    let root = crate::commands::root_dir()?;
    let config = crate::commands::load_config()?;
    config.validate()?;
    println!("workspace: {}", config.workspace.title);
    println!("books: {}", config.books.len());
    for book in &config.books {
        match detect_book_source(root.join(&book.source)) {
            Ok(detected) => println!("ok  {} ({})", book.id, detected.engine),
            Err(err) => println!("err {} ({err})", book.id),
        }
    }
    Ok(())
}
