pub fn if_os<'reg, 'rc>(
h: &Helper<'reg, 'rc>,
r: &'reg Handlebars<'reg>,
ctx: &'rc Context,
rc: &mut RenderContext<'reg, 'rc>,
out: &mut dyn Output,
) -> HelperResultExpand description
A templating helper that conditions on values parsed from target machine’s /etc/os-release file. The querying keys are case agnostic.
Usage:
-
{{#if_os "PRETTY_NAME" "foo,bar"}}..baz..{{/if_os}}Renders
..baz..only if current machine’s PRETTY_NAME is either “foo” or “bar” -
{{#if_os "id" "foo"}}..baz..{{else}}..qux..{{/if_os}}Renders
..baz..only if current machine’s ID is “foo”, renders..qux..only if current user’s ID is NOT “foo” -
{{#if_os "build_id" some.array}}..foo..{{/if_os}}Renders
..foo..only if current machine’s BUILD_ID is exactly one of the values from the templating variablesome.array(defined in the config file’s [[context]] section)“#,
[[context]]: dt_core::config::ContextConfig