From 0dc575709ea0fa3bc08ea6a9a59ff96e1d911d6f Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Sun, 1 Mar 2020 11:34:32 +0000 Subject: [PATCH] Force ainsi mode if not specified --- src/LaravelDeployer/Commands/BaseCommand.php | 8 ++++++++ src/LaravelDeployer/Concerns/ParsesCliParameters.php | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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');