Struct YAMLParseOptions

Struct Documentation

struct YAMLParseOptions

Options controlling which pre-processing steps parse_yaml() runs.

Pre-processing is performed in the following fixed order:

  1. **$include{path}** - replaced with the contents of the referenced YAML file (recursive; relative paths resolved against includesBasePath).

  2. **$(cmd)** - replaced with the trimmed stdout of the shell command cmd (exit code ≠ 0 throws).

  3. **${VAR}** or **${VAR|default}** - replaced with the value of an environment variable, a custom variables entry, or the built-in CURRENT_YAML_FILE_PATH token (falls back to default when given, otherwise throws if the variable is not defined).

Any of these steps can be individually disabled via the boolean flags below.

Public Members

bool doIncludes = {true}

If true (default), process $include{path} directives.

bool doCmdRuns = {true}

If true (default), process $(command) shell-run substitutions.

bool doEnvVars = {true}

If true (default), process ${VAR} / ${VAR|default} variable substitutions from the environment, variables, and built-in tokens.

std::map<std::string, std::string> variables

User-defined variable bindings for ${name} substitutions.

Entries in this map are checked after the real environment variables and the built-in CURRENT_YAML_FILE_PATH token, but before the |default fallback syntax.

std::string includesBasePath

Base directory used to resolve relative $include{} paths.

When non-empty, any relative path inside a $include{} expression is resolved relative to this directory. load_yaml_file() sets this automatically to the directory of the file being loaded.