improved init and started push

This commit is contained in:
JOLIMAITRE Matthieu 2022-09-26 00:17:38 +02:00
parent bb8ff09a7a
commit cb9a9a6316
2 changed files with 16 additions and 3 deletions

View file

@ -6,7 +6,7 @@ use std::{
use ron::ser::PrettyConfig;
use serde::{Deserialize, Serialize};
use crate::utils::Apply;
use crate::utils::{log_success, Apply};
#[derive(Debug, Serialize, Deserialize)]
pub struct Config {
@ -82,5 +82,11 @@ pub fn create(path: String) {
}
let name = absolute.file_name().unwrap();
let config = Config::new(name.to_str().unwrap().to_string());
config.write(absolute);
config.write(absolute.clone());
let path = absolute
.apply(|p| p.push(Config::CONFIG_FILE_NAME))
.to_str()
.unwrap()
.to_string();
log_success(&format!("created '{path}'"));
}

View file

@ -58,8 +58,11 @@ pub enum Commands {
command: String,
},
///
/// Initializes a project directory configuration, useful for custom flags, includes and custop push messages
init { path: String },
/// Pushes changes to the git server with a custom tag.
push,
}
fn append_includes(list: &mut Vec<String>) {
@ -120,5 +123,9 @@ fn main() {
}
Commands::init { path } => config::create(path),
Commands::push => {
todo!();
}
}
}