unless_os

Function unless_os 

Source
pub fn unless_os<'reg, 'rc>(
    h: &Helper<'reg, 'rc>,
    r: &'reg Handlebars<'reg>,
    ctx: &'rc Context,
    rc: &mut RenderContext<'reg, 'rc>,
    out: &mut dyn Output,
) -> HelperResult
Expand description

A templating helper that conditions on values parsed from target machine’s /etc/os-release file. It is the negated version of if_os. The querying keys are case agnostic.

Usage:

  1. `{{#unless_os “PRETTY_NAME” “foo,bar”}}..baz..{{/unless_os}}

    Renders ..baz.. only if current machine’s PRETTY_NAME is neither “foo” nor “bar”

  2. {{#unless_os "id" "foo"}}..baz..{{else}}..qux..{{/unless_os}}

    Renders ..baz.. only if current machine’s ID is NOT “foo”, renders ..qux.. only if current user’s ID is “foo”

  3. {{#unless_os "build_id" some.array}}..foo..{{/unless_os}}

    Renders ..foo.. only if current machine’s BUILD_ID is none of the values from the templating variable some.array (defined in the config file’s [[context]] section)“#,

[[context]]: dt_core::config::ContextConfig