//! Converts a blog repository into an SQLite database using the Tavern blog system.

mod info;



use clap::Parser;

use tavern::{Database, Tavern};



#[derive(Parser)]
#[command(version, about)]
struct Options
{
   #[arg(short = 'c', long = "config", default_value = "Tavern.toml")]
   config_file: std::path::PathBuf,

   #[arg(short = 'o', long = "output", default_value = "tavern.db")]
   output: std::path::PathBuf
}



#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>>
{
   let options = Options::parse();

   let tavern: Tavern = Tavern::from_config_file(&options.config_file);

   let database = Database::open(&options.output).await?;
   database.insert_tavern(&tavern).await?;

   Ok(())
}
