Allow executable arguments to be set for all docker-composer commands.

This commit is contained in:
Travis Tomka
2017-03-15 15:39:52 -06:00
parent 90b7786dc9
commit e3ace8a3ea
2 changed files with 107 additions and 6 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Droath\RoboDockerCompose;
use Robo\Common\CommandArguments;
/**
* Define command executable arguments.
*/
trait ExecutableArguments
{
/**
* Executable arguments.
*
* @var string
*/
protected $executableArgs = '';
/**
* Add executable options.
*
* @param string $option
* The executable option name.
* @param string $value
* The executable option value.
*/
protected function execOption($option, $value = null)
{
if (isset($option)) {
if (strpos($option, '-') !== 0) {
$option = "--$option";
}
$this->executableArgs .= null == $option ? '' : ' ' . $option;
$this->executableArgs .= null == $value ? '' : ' ' . CommandArguments::escape($value);
}
return $this;
}
}