From cbe132e0a4b8a95d80dcdf4f84a2ea34a4a52503 Mon Sep 17 00:00:00 2001 From: Sascha Baecher Date: Mon, 15 Apr 2024 03:18:51 +0200 Subject: [PATCH 1/2] Add option in 'patches-repatch' command for customizable composer install --- src/Command/RepatchCommand.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/Command/RepatchCommand.php diff --git a/src/Command/RepatchCommand.php b/src/Command/RepatchCommand.php old mode 100644 new mode 100755 index db0399f0..634f9b4c --- a/src/Command/RepatchCommand.php +++ b/src/Command/RepatchCommand.php @@ -7,6 +7,7 @@ use Composer\DependencyResolver\Operation\UninstallOperation; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class RepatchCommand extends PatchesCommandBase @@ -15,6 +16,12 @@ protected function configure(): void { $this->setName('patches-repatch'); $this->setDescription('Delete, re-download, and re-patch each dependency with any patches defined.'); + $this->addOption( + 'install-options', + 'o', + InputOption::VALUE_REQUIRED, + 'Allows you to set the parameters for the composer install.' + ); $this->setAliases(['prp']); } @@ -54,7 +61,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->requireComposer()->getLoop()->wait($promises); } - $input = new ArrayInput(['command' => 'install']); + $parameters = ['command' => 'install']; + + if (!empty($input->getOption('install-options'))) { + $installOptions = explode(' ', $input->getOption('install-options')); + + foreach ($installOptions as $installOption) { + $parameters[$installOption] = true; + } + } + + $input = new ArrayInput($parameters); $application = $this->getApplication(); $application->setAutoExit(false); $application->run($input, $output); From 2b83dee524635f11d6a5ec1948798d09040ffd71 Mon Sep 17 00:00:00 2001 From: Sascha Baecher Date: Mon, 15 Apr 2024 03:22:38 +0200 Subject: [PATCH 2/2] Change option description --- src/Command/RepatchCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/RepatchCommand.php b/src/Command/RepatchCommand.php index 634f9b4c..34cbdd30 100755 --- a/src/Command/RepatchCommand.php +++ b/src/Command/RepatchCommand.php @@ -20,7 +20,7 @@ protected function configure(): void 'install-options', 'o', InputOption::VALUE_REQUIRED, - 'Allows you to set the parameters for the composer install.' + 'Allows you to set the options for the composer install.' ); $this->setAliases(['prp']); }