mirror of
https://github.com/opdavies/versa.git
synced 2025-01-22 19:47:33 +00:00
Don't need to pass multiple arguments as a string
`./bin/console run -- --e prod --port 8001` now works without wrapping multiple arbitrary arguments within a string.
This commit is contained in:
parent
f94736183e
commit
d289a01f3a
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue