build.rs/src/main.rs

43 lines
1.1 KiB
Rust

use std::env;
use std::collections::HashMap;
use structopt::StructOpt;
mod log;
mod db;
mod dvcs;
mod cli;
fn main() {
let home_dir = env::var("HOME").expect("$HOME not defined. WTF?");
let base_dir = format!("{}/.git-build", home_dir);
let db = db::Database::from_folder(&base_dir);
let cmd = cli::Cli::from_args();
println!("{:?}", cmd);
let truc = db.tasks();
for task in truc {
let mut context = HashMap::new();
context.insert("$i18n_task", task.name.to_str().expect("WTF"));
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?
}
}