From 8c411011aadfd96e7189366f20dda87b26a50cbf Mon Sep 17 00:00:00 2001 From: BanceDev Date: Thu, 26 Feb 2026 12:40:51 -0500 Subject: add build support --- src/config.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/config.rs (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..f168b27 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,25 @@ +use serde::Deserialize; +use std::fs; +use std::path::Path; + +#[derive(Deserialize)] +pub struct Config { + pub update: Option, + pub build: Option, + pub install: Option, + pub dependencies: Option>, +} + +impl Config { + pub fn new>(filepath: P) -> Option { + let contents = match fs::read_to_string(filepath) { + Ok(c) => c, + Err(_) => { + eprintln!("no package config found"); + return None; + } + }; + let config: Config = toml::from_str(&contents).expect("failed to parse config"); + Some(config) + } +} -- cgit v1.2.3-59-g8ed1b