mirror of
https://github.com/opdavies/versa.git
synced 2025-02-08 18:35:03 +00:00
Rename --extra-args to --args
This commit is contained in:
parent
90e5e109e8
commit
5d32389606
|
@ -11,6 +11,10 @@
|
||||||
- Add `versa build` to build a Sculpin project.
|
- Add `versa build` to build a Sculpin project.
|
||||||
- Add `--extra-args` to pass extra arguments to the underlying command.
|
- Add `--extra-args` to pass extra arguments to the underlying command.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Rename `--extra-args` to `--args`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Support multiple extra args with spaces, e.g. `versa test --testdox --filter foo`.
|
- Support multiple extra args with spaces, e.g. `versa test --testdox --filter foo`.
|
||||||
|
|
|
@ -18,7 +18,7 @@ abstract class AbstractCommand extends Command
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
$this->addOption(
|
$this->addOption(
|
||||||
name: 'extra-args',
|
name: 'args',
|
||||||
shortcut: 'a',
|
shortcut: 'a',
|
||||||
mode: InputArgument::OPTIONAL,
|
mode: InputArgument::OPTIONAL,
|
||||||
description: 'Any additonal arguments to pass to the command.',
|
description: 'Any additonal arguments to pass to the command.',
|
||||||
|
|
|
@ -18,7 +18,7 @@ final class BuildCommand extends AbstractCommand
|
||||||
{
|
{
|
||||||
$projectType = null;
|
$projectType = null;
|
||||||
|
|
||||||
$extraArgs = $input->getOption('extra-args');
|
$args = $input->getOption('args');
|
||||||
$workingDir = $input->getOption('working-dir');
|
$workingDir = $input->getOption('working-dir');
|
||||||
|
|
||||||
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(
|
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(
|
||||||
|
@ -63,8 +63,8 @@ final class BuildCommand extends AbstractCommand
|
||||||
case ProjectType::Drupal->value:
|
case ProjectType::Drupal->value:
|
||||||
if ($isDockerCompose) {
|
if ($isDockerCompose) {
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: explode(separator: ' ', string: strval($args)),
|
||||||
command: ['docker', 'compose', 'build'],
|
command: ['docker', 'compose', 'build'],
|
||||||
extraArgs: explode(separator: ' ', string: strval($extraArgs)),
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ final class BuildCommand extends AbstractCommand
|
||||||
|
|
||||||
case ProjectType::Sculpin->value:
|
case ProjectType::Sculpin->value:
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: explode(separator: ' ', string: strval($args)),
|
||||||
command: ['./vendor/bin/sculpin', 'generate'],
|
command: ['./vendor/bin/sculpin', 'generate'],
|
||||||
extraArgs: explode(separator: ' ', string: strval($extraArgs)),
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ final class BuildCommand extends AbstractCommand
|
||||||
switch ($projectType) {
|
switch ($projectType) {
|
||||||
case ProjectType::Fractal->value:
|
case ProjectType::Fractal->value:
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: explode(separator: ' ', string: strval($args)),
|
||||||
command: ['npx', 'fractal', 'build'],
|
command: ['npx', 'fractal', 'build'],
|
||||||
extraArgs: explode(separator: ' ', string: strval($extraArgs)),
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ final class InstallCommand extends AbstractCommand
|
||||||
{
|
{
|
||||||
public function execute(InputInterface $input, OutputInterface $output): int
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$extraArgs = $input->getOption('extra-args');
|
$args = $input->getOption('args');
|
||||||
$workingDir = $input->getOption('working-dir');
|
$workingDir = $input->getOption('working-dir');
|
||||||
|
|
||||||
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(
|
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(
|
||||||
|
@ -26,12 +26,12 @@ final class InstallCommand extends AbstractCommand
|
||||||
|
|
||||||
// TODO: Composer in Docker Compose?
|
// TODO: Composer in Docker Compose?
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: explode(separator: ' ', string: strval($args)),
|
||||||
command: $this->getCommand(
|
command: $this->getCommand(
|
||||||
filesystem: $filesystem,
|
filesystem: $filesystem,
|
||||||
language: $language,
|
language: $language,
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
),
|
),
|
||||||
extraArgs: explode(separator: ' ', string: strval($extraArgs)),
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ final class RunCommand extends AbstractCommand
|
||||||
{
|
{
|
||||||
$projectType = null;
|
$projectType = null;
|
||||||
|
|
||||||
$extraArgs = $input->getOption('extra-args');
|
$args = $input->getOption('args');
|
||||||
$workingDir = $input->getOption('working-dir');
|
$workingDir = $input->getOption('working-dir');
|
||||||
|
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
|
@ -60,8 +60,8 @@ final class RunCommand extends AbstractCommand
|
||||||
|
|
||||||
if ($isDockerCompose) {
|
if ($isDockerCompose) {
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: $args,
|
||||||
command: ['docker', 'compose', 'up'],
|
command: ['docker', 'compose', 'up'],
|
||||||
extraArgs: $extraArgs,
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ final class RunCommand extends AbstractCommand
|
||||||
switch ($projectType) {
|
switch ($projectType) {
|
||||||
case ProjectType::Fractal->value:
|
case ProjectType::Fractal->value:
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: $args,
|
||||||
command: ['npx', 'fractal', 'start', '--sync'],
|
command: ['npx', 'fractal', 'start', '--sync'],
|
||||||
extraArgs: $extraArgs,
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ final class RunCommand extends AbstractCommand
|
||||||
|
|
||||||
case ProjectType::Sculpin->value:
|
case ProjectType::Sculpin->value:
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: $args,
|
||||||
command: ['./vendor/bin/sculpin', 'generate', '--server', '--watch'],
|
command: ['./vendor/bin/sculpin', 'generate', '--server', '--watch'],
|
||||||
extraArgs: $extraArgs,
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ final class TestCommand extends AbstractCommand
|
||||||
{
|
{
|
||||||
public function execute(InputInterface $input, OutputInterface $output): int
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$extraArgs = $input->getOption('extra-args');
|
$args = $input->getOption('args');
|
||||||
$workingDir = $input->getOption('working-dir');
|
$workingDir = $input->getOption('working-dir');
|
||||||
|
|
||||||
// TODO: add support for node and jest.
|
// TODO: add support for node and jest.
|
||||||
|
@ -33,8 +33,8 @@ final class TestCommand extends AbstractCommand
|
||||||
|
|
||||||
// TODO: commands in Docker Compose?
|
// TODO: commands in Docker Compose?
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
|
args: explode(separator: ' ', string: $args),
|
||||||
command: $command,
|
command: $command,
|
||||||
extraArgs: explode(separator: ' ', string: $extraArgs),
|
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ final class Process
|
||||||
/**
|
/**
|
||||||
* @param non-empty-array<int, non-empty-string> $command
|
* @param non-empty-array<int, non-empty-string> $command
|
||||||
* @param string $workingDir
|
* @param string $workingDir
|
||||||
* @param string[] $extraArgs
|
* @param string[] $args
|
||||||
*/
|
*/
|
||||||
public static function create(array $command, string $workingDir, array $extraArgs = []): SymfonyProcess
|
public static function create(array $command, string $workingDir, array $args = []): SymfonyProcess
|
||||||
{
|
{
|
||||||
$process = new SymfonyProcess(command: array_filter([...$command, ...$extraArgs]));
|
$process = new SymfonyProcess(command: array_filter([...$command, ...$args]));
|
||||||
$process->setTty(true);
|
$process->setTty(true);
|
||||||
$process->setWorkingDirectory($workingDir);
|
$process->setWorkingDirectory($workingDir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue