Add config helper to check whether hook is enabled or not

This commit is contained in:
Matthias Beyer 2016-09-20 09:13:40 +02:00
parent ece7fe061c
commit d115e4ca8e

View file

@ -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)
}