52 lines
1.5 KiB
Rust
52 lines
1.5 KiB
Rust
use std::env;
|
|
use std::collections::HashMap;
|
|
use structopt::StructOpt;
|
|
// For UNIX extended metadata
|
|
|
|
mod log;
|
|
mod db;
|
|
mod dvcs;
|
|
mod cli;
|
|
mod task;
|
|
|
|
fn main() -> Result<(), std::io::Error> {
|
|
|
|
let home_dir = env::var("HOME").expect("$HOME not defined. WTF?");
|
|
let base_dir = format!("{}/.git-build", home_dir);
|
|
|
|
//let entries = db::Database::from(&base_dir, is_executable)?;
|
|
let tasks = task::from_dir(&base_dir).expect("Could not load DB");
|
|
|
|
let cmd = cli::Cli::from_args();
|
|
|
|
/*
|
|
let tasks = if cmd.tasks.is_empty() {
|
|
db.tasks()
|
|
} else {
|
|
db.tasks_from(cmd.tasks).expect("Could not process the lsit of tasks given")
|
|
};
|
|
*/
|
|
for (task_name, task) in tasks.iter() {
|
|
let mut context = HashMap::new();
|
|
//context.insert("$i18n_task", task_name.to_str().expect("WTF"));
|
|
context.insert("$i18n_task", task_name.as_str());
|
|
log::debug("found_task", Some(&context));
|
|
if task.cloned == false {
|
|
// Maybe the task has a source we should clone?
|
|
if let Some(source) = &task.source {
|
|
|
|
if !task.dvcs.clone(source) {
|
|
context.insert("$i18n_source", &source);
|
|
log::error("clone_failed", Some(&context));
|
|
// Skip further processing
|
|
continue
|
|
}
|
|
}
|
|
// Otherwise, it's a sourceless task
|
|
continue
|
|
}
|
|
// So the cloned repo is here maybe update?
|
|
}
|
|
Ok(())
|
|
}
|