From 711deeef766a7b703e868cc0d1358f4320b9742f Mon Sep 17 00:00:00 2001 From: Penguin Date: Sun, 19 Dec 2021 02:37:10 -0600 Subject: [PATCH] config files --- igloo_core/src/igloo_manifest.rs | 46 +++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/igloo_core/src/igloo_manifest.rs b/igloo_core/src/igloo_manifest.rs index fc9c747..14b006d 100644 --- a/igloo_core/src/igloo_manifest.rs +++ b/igloo_core/src/igloo_manifest.rs @@ -1,5 +1,7 @@ // igloo_manifest is a simple collection of functions that work with configs +use std::collections::HashMap; +use std::vec::Vec; use crate::Igloo; use crate::IglooStatus; @@ -8,9 +10,12 @@ use crate::IglooStatus::*; use crate::IglooType; use crate::IglooType::*; +use crate::igloo_target::IglooTarget; + +/// Igloo Manifest Helper functions /// USES: environment variables (home dir, esf dir, current dir) /// DOES: brings target manifest into memory -pub fn get_master_target_manifest(inst: &mut Igloo) -> IglooStatus +pub fn imh_get_master_target_manifest(inst: &mut Igloo) -> IglooStatus { let mut ret: IglooStatus = IS_GOOD; @@ -27,3 +32,42 @@ pub fn get_master_target_manifest(inst: &mut Igloo) -> IglooStatus } ret } + +pub fn imh_get_project_name(inst: &Igloo) -> String +{ + let project_config: config::Config = config::Config::new(); + match project_config.merge( + config::File::with_name( + inst.env.cwd.clone().join("igloo.toml").to_str().unwrap())) + { + Ok(v) => + { + return v.deserialize::>().unwrap()["Project"] + } + Err(e) => panic!(), + } +} + +pub fn imh_get_targets(inst: &Igloo) -> Vec +{ + let project_config: config::Config = config::Config::new(); + match project_config.merge( + config::File::with_name( + inst.env.cwd.clone().join("igloo.toml").to_str().unwrap())) + { + Ok(v) => + { + match v.get("Targets") + { + Some(v2) => + { + for target in + { + + } + } + None => panic!(), + } + } + } +}