use anyhow::Result;
use clap::Parser;
use kgdata::db::{serve_db, PredefinedDB};
use kgdata::error::KGDataError;
use std::ffi::OsStr;
#[derive(Debug, Parser)]
struct ServerCLI {
db: PredefinedDB,
url: String,
datadir: String,
}
impl ServerCLI {
fn start(&self) -> Result<(), KGDataError> {
let db = self.db.open_raw_db(OsStr::new(&self.datadir))?;
serve_db(&self.url, &db)
}
}
fn main() -> Result<()> {
env_logger::init();
let cli = ServerCLI::parse();
cli.start()?;
Ok(())
}