diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 6fe223b..3168c45 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -23,10 +23,13 @@ abstract class AbstractCommand extends Command // ./bin/console install -- --no-dev // // And to set the port and environment for a Sculpin project, multiple - // arguments can be passed at once as a string: + // arguments can be passed at once: // - // ./bin/console run -- '-e prod --port 8001' - $this->addArgument('*'); + // ./bin/console run -- -e prod --port 8001 + $this->addArgument( + mode: InputArgument::IS_ARRAY, + name: '*', + ); $this->addOption( name: 'language', diff --git a/src/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php index ec58697..a356577 100644 --- a/src/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -78,7 +78,7 @@ final class BuildCommand extends AbstractCommand case ProjectType::Drupal->value: if ($isDockerCompose) { $process = Process::create( - args: explode(separator: ' ', string: strval($args)), + args: $args, command: ['docker', 'compose', 'build'], workingDir: $workingDir, ); @@ -93,7 +93,7 @@ final class BuildCommand extends AbstractCommand case ProjectType::Sculpin->value: $process = Process::create( - args: explode(separator: ' ', string: strval($args)), + args: $args, command: ['./vendor/bin/sculpin', 'generate'], workingDir: $workingDir, ); @@ -106,7 +106,7 @@ final class BuildCommand extends AbstractCommand switch ($projectType) { case ProjectType::Fractal->value: $process = Process::create( - args: explode(separator: ' ', string: strval($args)), + args: $args, command: ['npx', 'fractal', 'build'], workingDir: $workingDir, ); diff --git a/src/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php index 5166efd..046bc52 100644 --- a/src/Console/Command/InstallCommand.php +++ b/src/Console/Command/InstallCommand.php @@ -39,7 +39,7 @@ final class InstallCommand extends AbstractCommand // TODO: Composer in Docker Compose? $process = Process::create( - args: explode(separator: ' ', string: strval($args)), + args: $args, command: $this->getCommand(language: $language, workingDir: $workingDir), workingDir: $workingDir, ); diff --git a/src/Console/Command/PackageInstallCommand.php b/src/Console/Command/PackageInstallCommand.php index 9773376..4ba1e35 100644 --- a/src/Console/Command/PackageInstallCommand.php +++ b/src/Console/Command/PackageInstallCommand.php @@ -21,12 +21,12 @@ final class PackageInstallCommand extends AbstractCommand { public function configure(): void { - parent::configure(); - $this->addArgument( name: 'package-name', mode: InputArgument::REQUIRED, ); + + parent::configure(); } public function execute(InputInterface $input, OutputInterface $output): int @@ -47,7 +47,7 @@ final class PackageInstallCommand extends AbstractCommand switch ($language) { case ProjectLanguage::PHP->value: $process = Process::create( - args: explode(separator: ' ', string: $args ?? ''), + args: $args, command: ['composer', 'require', $input->getArgument('package-name')], workingDir: '.', ); @@ -78,7 +78,7 @@ final class PackageInstallCommand extends AbstractCommand } $process = Process::create( - args: explode(separator: ' ', string: $args ?? ''), + args: $args, command: $command, workingDir: $workingDir, ); diff --git a/src/Console/Command/RunCommand.php b/src/Console/Command/RunCommand.php index dde764f..f395a43 100644 --- a/src/Console/Command/RunCommand.php +++ b/src/Console/Command/RunCommand.php @@ -75,7 +75,7 @@ final class RunCommand extends AbstractCommand if ($isDockerCompose) { $process = Process::create( - args: explode(separator: ' ', string: $args ?? ''), + args: $args, command: ['docker', 'compose', 'up'], workingDir: $workingDir, ); @@ -86,7 +86,7 @@ final class RunCommand extends AbstractCommand switch ($projectType) { case ProjectType::Fractal->value: $process = Process::create( - args: explode(separator: ' ', string: $args ?? ''), + args: $args, command: ['npx', 'fractal', 'start', '--sync'], workingDir: $workingDir, ); @@ -97,7 +97,7 @@ final class RunCommand extends AbstractCommand case ProjectType::Sculpin->value: $process = Process::create( - args: explode(separator: ' ', string: $args ?? ''), + args: $args, command: ['./vendor/bin/sculpin', 'generate', '--server', '--watch'], workingDir: $workingDir, ); diff --git a/src/Console/Command/TestCommand.php b/src/Console/Command/TestCommand.php index 8598044..289fbb8 100644 --- a/src/Console/Command/TestCommand.php +++ b/src/Console/Command/TestCommand.php @@ -38,7 +38,7 @@ final class TestCommand extends AbstractCommand // TODO: commands in Docker Compose? $process = Process::create( - args: explode(separator: ' ', string: $args), + args: $args, command: $command, workingDir: $workingDir, );