Add config helper to check whether hook is enabled or not
This commit is contained in:
parent
ece7fe061c
commit
d115e4ca8e
1 changed files with 6 additions and 0 deletions
|
@ -167,3 +167,9 @@ fn get_bool_cfg(cfg: Option<&Value>, name: &str, on_fail: bool, on_unavail: bool
|
||||||
.unwrap_or(on_unavail)
|
.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue