From f873367a515479a39b90415d2aac60b4be3327c8 Mon Sep 17 00:00:00 2001 From: Valerie Date: Fri, 5 Jul 2024 14:36:31 -0400 Subject: [PATCH] updated man, version, and allow more data types in config variables --- Cargo.toml | 2 +- man/oink.1 | 34 ++++++++++++++++++++++++++++++++++ src/config.rs | 9 ++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 man/oink.1 diff --git a/Cargo.toml b/Cargo.toml index a62c3f6..c7ba6e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oink" -version = "0.2.0" +version = "0.2.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/man/oink.1 b/man/oink.1 new file mode 100644 index 0000000..7628746 --- /dev/null +++ b/man/oink.1 @@ -0,0 +1,34 @@ +.Dd $Mdocdate$ +.Dt OINK 1 +.Os +.Sh NAME +.Nm oink +.Nd a configuration file preprocessor +.Sh SYNOPSIS +.Nm +.Ar command +.Sh DESCRIPTION +.Nm +is a configuration file preprocessor focused on centralizing configuration changes. +.Ss COMMANDS +.Bl -tag -width Ds +.It apply +Copies the last generated files to their target paths. +.It build +Generates files from their templates. +.It full +Runs 'build', then 'apply'. +.El +.Sh EXIT STATUS +.Bl -tag -width Ds +.It 1 +No command was given. +.It 2 +The configuration file has no items in the target array. +.It 3 +Failed to create the configuration directories. +.El +.Sh AUTHORS +.An -nosplit +.An Valerie Wolfe Aq Mt sleeplessval@gmail.com + diff --git a/src/config.rs b/src/config.rs index f1a6e7b..4cac07a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -63,7 +63,14 @@ impl Config { // pull global vars if let Some(Value::Table(vars)) = self.inner.get("vars") { for (key, value) in vars.iter() { - output.insert(key.to_owned(), value.as_str().into()); + let key = key.to_owned(); + match value.clone() { + Value::Boolean(bool) => output.insert(key, bool.into()), + Value::Float(float) => output.insert(key, float.into()), + Value::Integer(int) => output.insert(key, int.into()), + Value::String(string) => output.insert(key, string.into()), + _ => None + }; } }