From 688d14bf9b9fc0c216700083f0121479d9f4e4d8 Mon Sep 17 00:00:00 2001 From: Penguin Date: Sat, 11 Jul 2020 00:23:08 -0500 Subject: [PATCH] adding config stuff. think im going to split it up later, but this is fine for now --- GPATH | Bin 65536 -> 0 bytes "src/\\" | 67 ---------------------------------------------------- src/main.rs | 38 +++++++++++++++++++++++++++-- src/util.rs | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 69 deletions(-) delete mode 100644 GPATH delete mode 100644 "src/\\" create mode 100644 src/util.rs diff --git a/GPATH b/GPATH deleted file mode 100644 index 88cafac88414bfa00e3cc14122ef288620297304..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65536 zcmeHw4Rl;rdEj+$h;i(AEKAmpW$T3mu#F?VH9su@x<;c z4ci)0^)qcR?Yec><8`m@4DP(_+UAPxxN^hIH(c5G;P#ic4Q{)1{pRbVTc3W@wl_t$ zJb&G`eK%is{~Mpb_U3CZY<}?#x4z-YYhK+H+%&WI`PQ3T@89#|7E979KKdX=u77Cn zi1}l4Q)l9Hw*(TWQuj>G$8I??KRFw_CozAzV{$$+4L`FT0nbQi(0#mPIvVeY&qeSa zTDW&1lA51spBCLZGD3QT_|VlSsv#Sjk0fS+D$=T2Mnw!{LRy$^(bZd(e3P@GsQVlU z$n>g~(Ig0h!G-iZ_|Vl;jhyqT2+4@Fs+Ez5fj~@a03W&zS0i6CF`tqGBCTrWV`3l? z(R!DZue&PwWLkhNL_0*py3GDY%GX&{e-n2vI42(w1A$n7NARJus{Uqrb}}^| zKSxSLde!E$g&;^q^kjS9Syg{C6`46L73oBK&cr|>l5Yg=qO+?0CUzDEEXB242&7xB zK1&IMpiI|`51m!@Ly|ly7HK&mD-Z*b3iZ3Qs(vRHcd&gYVjvKwmFjm@{ZDk^jC1vy zh;^F%57nEh`k&}5caToh8z$BX-HauFtLkT>PWInKth2a(>8z@MnT$GE{)iX|#QN*U z2X|Hdi&P)dskZJ)LL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!&#TnOs(4!VS&e$J8yrTS ztKN#TDwBw`zj%-?%%4`V*MsKPfDC?i%K8Y?q*c(f%%2fW9M=k%0Ih;1&yf+m5lOGA z{YRzqU_cYo@0GNx+KZ&-x-9v#>Wo+Ijded9olC*;QGQpo4~fp6V0x4{RqaFK^Cd`s zBwtl~kD~GniK6sYweN_|i2!W;ErzdtO$^?Am`faq2#X`aErH07Rf z_p0k5R~$JO21f_d9fqubU~0g{yy{HgRAP1pm(WVN--&VHwR)9#WvQIjwQ59*#;dEY zLl#=*IMucu%~GDgU-jB$EM0SE<`uZBUN5~Ox7Vyk9{*QM(>%MrFea3nh}Zc|QFgqm z#-Fri668l-Xmf_~Sry+eSK$SQDC83+K2?0vtjMRZ=E572=gi}p3rJTL-#RPvQ)@0P zX>;-$$T}u5+igserF=O3J*3Kqx&It_;hGE3W39f0%)RNzi@z0W^(|yub3tv4m(o{V z{iU^-mii<=5^7O*)^J$b3|L>`+}wh-UKQ4G ZfDOW;(^|Drw1(rlB3`v>pUm&f{|^(nf - { - println!("Creating new project named {}", new_matches.value_of("NAME").unwrap()); - } - ("run", Some(run_matches)) => - { - ("RELEASE") => println!("Running as release build"), - ("DEBUG") => println!("Running as debug build"), - ("FRESH") => println!("Running as fresh!"), - ("", None) => println!("No subarg was used!"), - _ => unreachable!(), - } - ("", None) => println!("No subcommand was used"), - _ => unreachable!(), - } - - -} diff --git a/src/main.rs b/src/main.rs index 1703713..6a06882 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,10 @@ extern crate clap; use clap::{Arg, App, ArgGroup}; use std::str::FromStr; use std::process; +use std::path::Path; +use std::fs; +use std::fs::{File, OpenOptions}; +use std::os::unix; enum BuildTypes { Release, @@ -32,7 +36,7 @@ fn main() author: crate_authors!().to_owned(), description: crate_description!().to_owned(), }; - let matches = App::new(_igloo.name) + let matches = App::new(&*_igloo.name) .version(&*_igloo.version) .author(&*_igloo.author) .about(&*_igloo.description) @@ -87,7 +91,7 @@ fn main() { ("new", Some(new_matches)) => { - println!("Creating new project named {}", new_matches.value_of("NAME").unwrap()); + igloo_new(&_igloo, new_matches.value_of("NAME").unwrap()); } ("run", Some(run_matches)) => @@ -114,6 +118,8 @@ fn main() _igloo.debug_mode = false; } + igloo_run(&_igloo); + } ("build", Some(build_matches)) => @@ -143,7 +149,35 @@ fn main() _ => unreachable!(), } } +fn igloo_new_with_dir(igloo_inst: &Igloo, prj_name: &str, prj_dir: &str) +{ + // WIP +} +fn igloo_new(igloo_inst: &Igloo, prj_name: &str) +{ + let path = Path::new(prj_name); + if path.exists() + { + println!("Project already exists. Exiting..."); + process::exit(1); + } + + println!("Making new project named {}", path.display()); + match fs::create_dir(prj_name) + { + Err(why) => println!("! {:?}", why.kind()), + Ok(_) => {}, + } + if cfg!(target_family = "unix") + { + println!("You are on unix!\n"); + } + else + { + println!("only unix is currently supported!"); + } +} fn igloo_run(igloo_inst: &Igloo) { diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..0d31878 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,67 @@ +use std::vec::Vec; +use std::string::String; +use std::collections::HashMap; +use std::fmt::Display; +use config::*; + +struct McuManifest +{ + ep_deps: HashMap, + makefile_default_src_files: Vec, + makefile_default_inc_dirs: Vec, + drivers: Vec, + modules: Vec, +} +impl Display for McuManifest +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result + { + // print ep deps + write!(f, "Printing EP DEPS:\n").unwrap(); + for dep in &self.ep_deps + { + write!(f, "{}: {}\n", &dep.0, &dep.1).unwrap(); + } + + // print makefile default src files + write!(f, "\nDefault makefile sources:\n").unwrap(); + for src_file in &self.makefile_default_src_files + { + write!(f, "{}\n", &src_file).unwrap(); + } + + // print makefile default inc dirs + for inc_dir in &self.makefile_default_inc_dirs + { + write!(f, "{}\n", &inc_dir).unwrap(); + } + + // Available drivers + write!(f, "\nAvailable drivers:\n").unwrap(); + for driver in &self.drivers + { + write!(f, "{}\n", &driver).unwrap(); + } + + // Available modules + write!(f, "\nAvailable modules:\n").unwrap(); + for module in &self.modules + { + write!(f, "{}\n", &module).unwrap(); + } + + Ok(()) + } +} + +fn yml_to_mcu_manifest(conf: &mut config::Config) -> McuManifest +{ + McuManifest + { + ep_deps: conf.get_table("EP_DEPS").unwrap_or_default(), + makefile_default_inc_dirs: conf.get_array("MAKEFILE_DEFAULT_INC_DIRS").unwrap_or_default(), + makefile_default_src_files: conf.get_array("MAKEFILE_DEFAULT_SRC_FILES").unwrap_or_default(), + drivers: conf.get_array("DRIVERS").unwrap_or_default(), + modules: conf.get_array("MODULES").unwrap_or_default(), + } +}