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 34 35 36 37 38 39 40
extern crate ansi_term; extern crate serde; extern crate serde_yaml; #[macro_use] extern crate serde_derive; use app::run_app; use init::run_setup; use std::env; use std::env::VarError; use std::path::PathBuf; macro_rules! s { () => (String::new()); ($($arg:tt)*) => (String::from($($arg)*)); } mod commands; mod model; mod config; mod dto; mod util; mod workflow; mod app; mod init; #[cfg(test)] mod test_helper; pub fn run() { get_commands_directory() .map(run_app) .unwrap_or_else(|_| run_setup()); } fn get_commands_directory() -> Result<PathBuf, VarError> { env::var("COMMANDS_DIRECTORY") .map(|a| PathBuf::from(a)) }