Allow executable arguments to be set for all docker-composer commands.
This commit is contained in:
41
src/ExecutableArguments.php
Normal file
41
src/ExecutableArguments.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user