gcd-cli 0.2.1

gcd-cli tools for managing and using GCD. GCD stands for GitChangeDirectory, as it primary goal is to quickly change between git project folders.
Documentation
use std::io;
use clap::{App, Arg, crate_version, crate_authors};
use gcd_cli::db::Database;
use gcd_cli::config::Config;
use gcd_cli::constants::*;

fn main() -> io::Result<()>{
    let config = Config::new();
    let default_database_file = config.database_file();
    let matches = App::new("gcd-delete")
        .version(&crate_version!()[..])
        .author(crate_authors!())
        .about("Remove current folder from the database.")
        .arg(
            Arg::with_name(DATABASE_FILE)
                .short("d")
                .long(DATABASE_FILE)
                .env(DATABASE_FILE)
                .value_name(DATABASE_FILE_VALUE_NAME)
                .default_value(&default_database_file)
                .help(DATABASE_FILE_HELP)
                .required(false)
                .takes_value(true),
        ).get_matches();

    let database_file = matches
        .value_of(DATABASE_FILE)
        .unwrap_or(&default_database_file)
        .to_string();

    let database = Database::new(database_file);
    let cwd = std::env::current_dir()?;

    match cwd.to_str() {
        Some(str) => database.remove(str.to_string()),
        None => {
            println!(
                "Failed to convert {}, not an utf8 path name",
                cwd.display()
            );
        }
    }
    Ok(())

}