diff --git a/CHANGELOG.md b/CHANGELOG.md index ab28ab5..7aaf7e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixed +* Support multiple extra args with spaces, e.g. `versa test --testdox --filter foo`. * Prevent timeout errors with `versa run`. ## 0.2.0 diff --git a/src/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php index 04363d7..a359a64 100644 --- a/src/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -62,7 +62,7 @@ final class BuildCommand extends AbstractCommand if ($isDockerCompose) { $process = Process::create( command: ['docker', 'compose', 'build'], - extraArgs: $extraArgs, + extraArgs: explode(separator: ' ', string: $extraArgs), workingDir: $workingDir, ); @@ -77,7 +77,7 @@ final class BuildCommand extends AbstractCommand case ProjectType::Sculpin->value: $process = Process::create( command: ['./vendor/bin/sculpin', 'generate'], - extraArgs: $extraArgs, + extraArgs: explode(separator: ' ', string: $extraArgs), workingDir: $workingDir, ); @@ -90,7 +90,7 @@ final class BuildCommand extends AbstractCommand case ProjectType::Fractal->value: $process = Process::create( command: ['npx', 'fractal', 'build'], - extraArgs: $extraArgs, + extraArgs: explode(separator: ' ', string: $extraArgs), workingDir: $workingDir, ); diff --git a/src/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php index 5f5e923..f7fed18 100644 --- a/src/Console/Command/InstallCommand.php +++ b/src/Console/Command/InstallCommand.php @@ -30,7 +30,7 @@ final class InstallCommand extends AbstractCommand language: $this->getProjectLanguage($filesystem, $workingDir, $input), workingDir: $workingDir, ), - extraArgs: $extraArgs, + extraArgs: explode(separator: ' ', string: $extraArgs), workingDir: $workingDir, ); diff --git a/src/Console/Command/TestCommand.php b/src/Console/Command/TestCommand.php index 0809cb9..1485db2 100644 --- a/src/Console/Command/TestCommand.php +++ b/src/Console/Command/TestCommand.php @@ -32,7 +32,7 @@ final class TestCommand extends AbstractCommand // TODO: commands in Docker Compose? $process = Process::create( command: $command, - extraArgs: $extraArgs, + extraArgs: explode(separator: ' ', string: $extraArgs), workingDir: $workingDir, ); diff --git a/src/Process/Process.php b/src/Process/Process.php index e95bbd1..fe5f87d 100644 --- a/src/Process/Process.php +++ b/src/Process/Process.php @@ -14,11 +14,11 @@ final class Process /** * @param non-empty-array $command * @param string $workingDir - * @param ?string $extraArgs + * @param non-empty-string[] $extraArgs */ - public static function create(array $command, string $workingDir, ?string $extraArgs = null): SymfonyProcess + public static function create(array $command, string $workingDir, array $extraArgs = []): SymfonyProcess { - $process = new SymfonyProcess(command: array_filter([...$command, $extraArgs])); + $process = new SymfonyProcess(command: array_filter([...$command, ...$extraArgs])); $process->setTty(true); $process->setWorkingDirectory($workingDir);