Skip to content

Instantly share code, notes, and snippets.

@ahonor
Created June 30, 2014 23:49
Show Gist options
  • Save ahonor/0a6f53c8e2d5c0febb40 to your computer and use it in GitHub Desktop.
Save ahonor/0a6f53c8e2d5c0febb40 to your computer and use it in GitHub Desktop.
conditional args to a command
<joblist>
<job>
<id>8e8ab4b9-665e-4aae-b7e0-601845d3c152</id>
<loglevel>INFO</loglevel>
<sequence keepgoing='false' strategy='node-first'>
<command>
<scriptargs />
<script><![CDATA[#!/usr/bin/env bash
clopts=()
[[ -n "$RD_OPTION_SOMEOPTION" ]] && clopts=(--some-option $RD_OPTION_SOMEOPTION)
[[ -n "$RD_OPTION_DEBUG" ]] && clopts=( ${clopts[*]} --debug )
echo "the clopts are: ${clopts[*]}"]]></script>
</command>
</sequence>
<description>debug the thing</description>
<name>debug_it</name>
<context>
<project>examples</project>
<options>
<option name='debug_flag'>
<description>if true set the flag</description>
</option>
<option name='someoption' values='a,b,c,d' multivalued='true' delimiter=','>
<description>this is another arg</description>
</option>
</options>
</context>
<uuid>8e8ab4b9-665e-4aae-b7e0-601845d3c152</uuid>
</job>
</joblist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment