diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-09-20 09:13:40 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-09-20 09:35:02 +0200 |
commit | d115e4ca8e0aac7a6a8726e495be1ccfc3da4c72 (patch) | |
tree | b23be7a7dda0ac7df802bbb058bc912e3affbe75 /libimagstorestdhook/src | |
parent | ece7fe061c0d030138b185a26efae34cff4d35c2 (diff) |
Add config helper to check whether hook is enabled or not
Diffstat (limited to 'libimagstorestdhook/src')
-rw-r--r-- | libimagstorestdhook/src/vcs/git/config.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libimagstorestdhook/src/vcs/git/config.rs b/libimagstorestdhook/src/vcs/git/config.rs index db1a4d3d..25609cea 100644 --- a/libimagstorestdhook/src/vcs/git/config.rs +++ b/libimagstorestdhook/src/vcs/git/config.rs @@ -167,3 +167,9 @@ fn get_bool_cfg(cfg: Option<&Value>, name: &str, on_fail: bool, on_unavail: bool .unwrap_or(on_unavail) } +/// Check whether the hook is enabled or not. If the config is not there, the hook is _enabled_ by +/// default. +pub fn is_enabled(cfg: &Value) -> bool { + get_bool_cfg(Some(cfg), "enabled", true, true) +} + |