diff --git a/src/LaravelDeployer/Commands/BaseCommand.php b/src/LaravelDeployer/Commands/BaseCommand.php index b51d8f0..4674a1a 100644 --- a/src/LaravelDeployer/Commands/BaseCommand.php +++ b/src/LaravelDeployer/Commands/BaseCommand.php @@ -43,16 +43,24 @@ public function __construct() public function dep($command) { + // Merge arguments and options. $this->parameters = $this->getParameters(); $this->providedFile = $this->parameters->pull('--file'); $this->providedStrategy = $this->parameters->pull('--strategy'); + // Force Ansi mode if not specified. + if ($this->parameters->intersect(['--ansi', '--no-ansi'])->isEmpty()) { + $this->parameters->push('--ansi'); + } + + // Fetch deploy config file. if (! $deployFile = $this->getDeployFile()) { $this->error("config/deploy.php file not found."); $this->error("Please run `php artisan deploy:init` to get started."); return; } + // Delegate to DeployerPHP with the right parameters. $parameters = $this->getParametersAsString($this->parameters); $depBinary = 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'dep'; return $this->process("$depBinary --file=$deployFile $command $parameters"); diff --git a/src/LaravelDeployer/Concerns/ParsesCliParameters.php b/src/LaravelDeployer/Concerns/ParsesCliParameters.php index 5cb564c..dbea05c 100644 --- a/src/LaravelDeployer/Concerns/ParsesCliParameters.php +++ b/src/LaravelDeployer/Concerns/ParsesCliParameters.php @@ -22,8 +22,8 @@ public function getParameters() public function parseArguments() { return collect($this->arguments()) - ->reject(function ($value) { - return ! $value && ! is_string($value) && ! is_numeric($value); + ->filter(function ($value) { + return $value || is_string($value) || is_numeric($value); }) ->pipe(function ($arguments) { $command = $arguments->get('command');