Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 648 Bytes

File metadata and controls

25 lines (16 loc) · 648 Bytes

Contributing

Workflows

Optional arguments

To deal with optional arguments in a template, prioritize conditionally passing the argument rather than passing it with no value.

Good

args:
  - "{{= sprig.empty(inputs.parameters.start_datetime) ? '' : '--start-year=' + sprig.trunc(4, inputs.parameters.start_datetime) }}"

Will result to not passing --start-year at all if inputs.parameters.start_datetime is empty.

Bad

args:
  - '--start-year={{=sprig.trunc(4, inputs.parameters.start_datetime)}}

Will result to pass --start-year= (empty value). This can cause an issue with some CLI tools.