From 82911550d281d0b4e1a8de50da0c0140dcb72594 Mon Sep 17 00:00:00 2001 From: Penguin Date: Sun, 19 Jul 2020 13:54:59 -0500 Subject: [PATCH] project manager, mcumanifest, makemanifest, and climanager work. rethinking structure --- GPATH | Bin 65536 -> 65536 bytes src/igloo.rs | 42 +++++++++++++++++++++++++----------------- src/main.rs | 2 ++ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/GPATH b/GPATH index 1b37f1fb0502f05520aa4c4207e0bb3c42f44fa6..d10cd0afe5788932493a5bc8b3872c933de12f52 100644 GIT binary patch delta 125 zcmZo@U}UpsYuLmmn_$poc?QtfC4tB_OA|L?qNunEd0QAa?}G8CeN_VeGfKq$t7Iw0BbwY3Za8tgPi?+<2{X> MfrQ`YxYvtB0K=sx?*IS* diff --git a/src/igloo.rs b/src/igloo.rs index 3405c00..552769e 100644 --- a/src/igloo.rs +++ b/src/igloo.rs @@ -4,6 +4,7 @@ use std::vec::Vec; use std::string::String; use std::collections::HashMap; use config::*; +use std::error::Error; use clap::{Arg, App}; enum BuildType @@ -11,16 +12,24 @@ enum BuildType Release, Debug, } -// used for managing existing igloo projects -// Igloo Project Manager - A struct for holding all -// information pertaining to the current Igloo Project -// An igloo project uses the .igloo folder to maintain -// knowledge of its existence. pub struct ProjectManager { - + makeManifest: MakeManifest, + mcuManifest: McuManifest, } +impl ProjectManager +{ + pub fn get_config() -> Self + { + let mut conf = Config::default(); + ProjectManager + { + makeManifest: MakeManifest::from_config(&mut conf), + mcuManifest: McuManifest::from_config(&mut conf), + } + } +} // used for managing cli requests for new and existing igloo projects pub struct CliManager<'b> { @@ -28,33 +37,32 @@ pub struct CliManager<'b> debug_mode: bool, release_mode: bool, fresh_mode: bool, - version: String, - name: String, + version: &'b str, + name: &'b str, author: &'b str, description: &'b str, } impl<'b> CliManager<'b> { - pub fn new(this: &'b Self) -> Self + pub fn new() -> Self { - let _version = "v".to_owned() + crate_version!(); CliManager { - version: _version.to_owned(), - name: crate_name!().to_owned(), + version: concat!("v", crate_version!()), + name: crate_name!(), author: crate_authors!(), description: crate_description!(), debug_mode: true, release_mode: false, fresh_mode: false, - app: clap::App::new(this.name) - .author(this.author) - .version(&*this.version) - .about(this.description), - + app: clap::App::new(crate_name!()) + .author(crate_authors!()) + .version(concat!("v", crate_version!())), } } + + } // Make Manifest contains default flags, files, and // include directories. User files, flags, and directories diff --git a/src/main.rs b/src/main.rs index 7d4aa00..a6b1ae9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,8 @@ fn main() { println!("Hi"); let _igloo = igloo::CliManager::new(); + let pm = igloo::ProjectManager::get_config(); + // let mut _igloo: Igloo = Igloo // { // debug_mode: true,