Allow for arbitrary arguments

Remove the `--args` option and allow for arbitrary arguments.
This commit is contained in:
Oliver Davies 2024-03-12 21:25:56 +00:00
parent e499d42fa5
commit f94736183e
7 changed files with 21 additions and 13 deletions

View file

@ -2,9 +2,13 @@
## Unreleased
### Fixed
N/A.
- Fix `args` in `run` command.
## 0.4.0 (2024-03-12)
### Changed
- Remove the `args` command and allow for arbitrary arguments - e.g. `./bin/console install -- --no-dev` to run `composer install` with the `--no-dev` option.
## 0.3.0 (2024-02-25)

View file

@ -17,12 +17,16 @@ abstract class AbstractCommand extends Command
protected function configure(): void
{
$this->addOption(
name: 'args',
shortcut: 'a',
mode: InputArgument::OPTIONAL,
description: 'Any additonal arguments to pass to the command.',
);
// Allow for passing arbitrary arguments to the underlying command, for
// example, to run `composer install` with the `--no-dev` option:
//
// ./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:
//
// ./bin/console run -- '-e prod --port 8001'
$this->addArgument('*');
$this->addOption(
name: 'language',

View file

@ -24,7 +24,7 @@ final class BuildCommand extends AbstractCommand
{
$projectType = null;
$args = $input->getOption('args');
$args = $input->getArgument('*');
$workingDir = $input->getOption('working-dir');
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(

View file

@ -21,7 +21,7 @@ final class InstallCommand extends AbstractCommand
{
public function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getOption('args');
$args = $input->getArgument('*');
$language = $input->getOption('language');
$workingDir = $input->getOption('working-dir');

View file

@ -31,7 +31,7 @@ final class PackageInstallCommand extends AbstractCommand
public function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getOption('args');
$args = $input->getArgument('*');
$workingDir = $input->getOption('working-dir');
$language = $input->getOption('language') ?? (new DetermineProjectLanguage(

View file

@ -22,7 +22,7 @@ final class RunCommand extends AbstractCommand
{
$projectType = null;
$args = $input->getOption('args');
$args = $input->getArgument('*');
$workingDir = $input->getOption('working-dir');
$filesystem = new Filesystem();

View file

@ -16,7 +16,7 @@ final class TestCommand extends AbstractCommand
{
public function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getOption('args');
$args = $input->getArgument('*');
$workingDir = $input->getOption('working-dir');
// TODO: add support for node and jest.