extern crate leek;

use leek::database::Database;

use std::env;
use std::error;
use std::path::PathBuf;
use std::process;

type Error = Box<'static + error::Error>;

fn main() {
    safe_main().unwrap();
}

fn safe_main() -> Result<(), Error> {
    let arguments = env::args().collect::<Vec<_>>();
    if arguments.len() != 2 {
        eprintln!("Usage: {} DATA-DIRECTORY", arguments[0]);
        process::exit(1);
    }
    Database::initialize(PathBuf::from(&arguments[1]))?;
    Ok(())
}
