1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

extern crate clap;
extern crate console;
extern crate regex;
extern crate rusqlite;
extern crate glob;
extern crate indicatif;
extern crate ctrlc;

pub mod error;
pub mod inputhandler;
pub mod outputhandler;
pub mod scriptfile;
pub mod db;
pub mod projectsfinder;
pub mod config;
pub mod constants;

pub mod lib {
    use std::path::PathBuf;
    use anyhow::Result;
    use crate::error::GcdError;

    pub fn current_dir() -> Result<String> {
        Ok(to_string(std::env::current_dir()?)?)
    }

    pub fn to_string(path: PathBuf) -> Result<String> {
        Ok(path.to_str().ok_or_else(|| {
            GcdError::new(format!("Failed to convert {}, not an utf8 path name", path.display()))
        })?.to_owned())
    }
}