Skip to main content

flatten_conditional_args

Function flatten_conditional_args 

Source
pub fn flatten_conditional_args(args: &[Value]) -> Vec<String>
Expand description

Flatten a resolved args array that may contain conditional groups.

After template resolution, the args array can contain:

  • Flat string: included if non-empty, dropped if ""
  • Nested array: ALL elements must be non-empty strings → flattened into parent; if ANY element is "" → entire group dropped
  • Other types: dropped (backward compat)

This enables conditional flag groups in recipes:

"args": ["--always", ["--cookies-from-browser", "{{fields.browser}}"], "{{fields.thumbnail}}"]

When browser="": ["--always"] When browser="chrome": ["--always", "--cookies-from-browser", "chrome"]