From ccdca17345dcc250e24a8a294e5252cbd1a49406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Thu, 7 May 2020 10:39:48 +0200 Subject: [PATCH] Filter the libraries to split by the selected libraries --- src/Command/SplitCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Command/SplitCommand.php b/src/Command/SplitCommand.php index 2af89de..f64badc 100644 --- a/src/Command/SplitCommand.php +++ b/src/Command/SplitCommand.php @@ -140,7 +140,7 @@ protected function initLibraries(InputInterface $input): void $config = $this->getReleaser()->getConfig(); $baseDir = $config->getBaseDir(); $configLibraries = (array) $config->get('libraries', []); - $libraryNames = $input->getArgument('library'); + $libraryNames = (array) $input->getArgument('library'); $this->libraries = $configLibraries; foreach ($libraryNames as $libraryName) { @@ -157,6 +157,8 @@ protected function initLibraries(InputInterface $input): void foreach (array_keys($this->libraries) as $libraryName) { if (!isset($configLibraries[$libraryName]) || !is_dir($baseDir.'/'.$libraryName)) { unset($this->libraries[$libraryName]); + } elseif (!empty($libraryNames) && !\in_array($libraryName, $libraryNames, true)) { + unset($this->libraries[$libraryName]); } } } @@ -172,9 +174,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $fetch = $input->getOption('fetch'); $allowScratch = $input->getOption('scratch'); $allLibraries = $input->getOption('all-lib'); + $libraryNames = (array) $input->getArgument('library'); foreach ($this->branches as $branch) { - $libraryPaths = $allLibraries + $libraryPaths = $allLibraries || !empty($libraryNames) ? array_keys($this->libraries) : GitUtil::getLibraries($this->libraries, $branch, $this->depth);