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 clap::{crate_authors, crate_version, App, Arg};
use gcd_cli::config::Config;
use gcd_cli::db::Database;
use gcd_cli::projectsfinder::find_projects;
use gcd_cli::constants::*;

fn main() {
    let config = Config::new();
    let default_database_file = config.database_file();
    let default_projects_dir = config.projects_dir();

    let matches = App::new("gcd-update")
        .version(&crate_version!()[..])
        .author(crate_authors!())
        .about("Update the database with new projects. Same as gcd-init accept that it wil not clear the database first.")
        .arg(
            Arg::with_name(PROJECTS_DIR)
                .short("p")
                .long(PROJECTS_DIR)
                .env(PROJECTS_DIR)
                .value_name(PROJECTS_DIR_VALUE_NAME)
                .default_value(&default_projects_dir)
                .help(PROJECTS_DIR_HELP)
                .required(false)
                .takes_value(true),
        )
        .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 projects_dir = matches
        .value_of(PROJECTS_DIR)
        .unwrap_or(&default_projects_dir)
        .to_string();

    let database = Database::new(database_file);
    let lines = find_projects(projects_dir);
    database.add_new(lines);
}