Variable length command line options
I am trying to create a directive using shell
or command
, to accomplish something that can contain any number of command line arguments.
So something like
- Name: Runs MediaWiki command line setup.
command: "php /opt/wiki/maintanance/install.php {{ arguments }}"
I am looking for something like [item for "%s=%s % (key, value) in arguments"]
Looking at the variables available, all I see there wants to loop each command on any of the datastruture data.
Does anyone know what is the best way to join an arbitrary argument list for a command and structure this in the best way in a variable file?
source to share
If arguments
is a list, you can use a filter.
- Name: Runs MediaWiki command line setup.
command: "php /opt/wiki/maintanance/install.php {{ arguments | join }}"
If arguments
is a dict, you can do something like this:
- Name: Runs MediaWiki command line setup.
command: "php /opt/wiki/maintanance/install.php {{ arguments | urlencode | replace('&', ' ') }}"
source to share