diff --git a/src/helpers/config.rs b/src/helpers/config.rs new file mode 100644 index 0000000..1dd685c --- /dev/null +++ b/src/helpers/config.rs @@ -0,0 +1,11 @@ +use toml::value::Table; + +pub trait Config { + fn get_string (&self, key: &str) -> Option<&str>; +} + +impl Config for Table { + fn get_string (&self, key: &str) -> Option<&str> { + self.get(key).and_then(|value| value.as_str()) + } +} diff --git a/src/helpers/mod.rs b/src/helpers/mod.rs index 9fe7961..6d982ac 100644 --- a/src/helpers/mod.rs +++ b/src/helpers/mod.rs @@ -1 +1,2 @@ pub mod command; +pub mod config;