WIP: setup-home-dir #1

Draft
bogusoverflow wants to merge 5 commits from bogusoverflow/git-build.rs:setup-home-dir into main
1 changed files with 12 additions and 1 deletions
Showing only changes of commit ac631f9b67 - Show all commits

View File

@ -1,6 +1,8 @@
use std::env;
use std::collections::HashMap;
use structopt::StructOpt;
use std::fs::{DirBuilder};
use std::path::Path;
// For UNIX extended metadata
mod log;
@ -14,6 +16,15 @@ 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);
// We're gonna check if they already is a .git-build folder, and create one otherwise.
if !Path::new(&base_dir).exists() {
log::info("create_git_build_folder", Some(&HashMap::new()));
DirBuilder::new()
.recursive(true)
.create(&base_dir).unwrap();
}
let cmd = cli::Cli::from_args();
let tasks = if cmd.tasks.is_empty() {
@ -21,7 +32,7 @@ fn main() -> Result<(), std::io::Error> {
} else {
task::from_dir_and_list(&base_dir, cmd.tasks).expect("Could not load given tasks")
};
for (task_name, task) in tasks.iter() {
let mut context = HashMap::new();
//context.insert("$i18n_task", task_name.to_str().expect("WTF"));