diff --git a/src/config.rs b/src/config.rs index 4822548..aa65dad 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,12 +1,13 @@ use std::{ env, fs, + io::stdin, path::{Path, PathBuf}, }; use ron::ser::PrettyConfig; use serde::{Deserialize, Serialize}; -use crate::utils::{log_success, Apply}; +use crate::utils::{log_process, log_success, Apply}; #[derive(Debug, Serialize, Deserialize)] pub struct Config { @@ -33,6 +34,11 @@ impl Config { path.extend([Self::CONFIG_FILE_NAME]); let content = ron::ser::to_string_pretty(self, PrettyConfig::default().struct_names(true)).unwrap(); + if path.exists() { + log_process("config already exists, overwrite it?"); + let mut buff = String::new(); + stdin().read_line(&mut buff).unwrap(); + } fs::write(path, content).unwrap(); } diff --git a/src/main.rs b/src/main.rs index d79e861..652f46e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,6 +89,7 @@ fn compilation_args() -> Vec { "-Wall".to_string(), "-Wextra".to_string(), "-std=c99".to_string(), + "-pedantic".to_string(), ]; if Config::get_local_or_default().strict_mode() { args.push("-Werror".to_string()); @@ -138,7 +139,8 @@ fn main() { } => { let path = path.unwrap_or_else(|| env::current_dir().unwrap().to_str().unwrap().to_string()); - config::create(path.clone(), prefix); + let prefix = prefix.trim().trim_end_matches('*'); + config::create(path.clone(), prefix.to_string()); if tests { config::create_test(path); }