summaryrefslogtreecommitdiffstats
path: root/src/module.rs
diff options
context:
space:
mode:
authorAndrew Dassonville <dassonville.andrew@gmail.com>2019-07-28 18:05:13 -0700
committerMatan Kushner <hello@matchai.me>2019-07-28 21:05:13 -0400
commit5dbf4381acd1fd8dbb2905828c3fcc6515d850cf (patch)
tree36a13ea34b8af9c0f6c5fa30c8ae9d7c3835f0de /src/module.rs
parentab46710fc47891a80eb1b6073616c95a1acc92bd (diff)
feat: Allow directory truncation length to be configured (#120)
This allows the directory truncation length to be configured. Previously, it was hard-coded to truncate to 3 parent directories.
Diffstat (limited to 'src/module.rs')
-rw-r--r--src/module.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/module.rs b/src/module.rs
index af985ea3a..526345b95 100644
--- a/src/module.rs
+++ b/src/module.rs
@@ -99,6 +99,16 @@ impl<'a> Module<'a> {
fn config_value(&self, key: &str) -> Option<&str> {
self.config.and_then(|config| config.get_as_str(key))
}
+
+ /// Get a module's config value as an int
+ pub fn config_value_i64(&self, key: &str) -> Option<i64> {
+ self.config.and_then(|config| config.get_as_i64(key))
+ }
+
+ /// Get a module's config value as a bool
+ pub fn config_value_bool(&self, key: &str) -> Option<bool> {
+ self.config.and_then(|config| config.get_as_bool(key))
+ }
}
impl<'a> fmt::Display for Module<'a> {