Do not throw InvalidArgumentException with the 'show' command if the working-dir argument is set and composer.json exists

- This prevents scripts from aborting when looping through a directory of projects
main
Ed Reel 8 years ago committed by Jordi Boggiano
parent 5ecd9ace59
commit afdae9c0e2

@ -166,8 +166,19 @@ EOT
if (empty($package)) {
list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
if (!$package) {
throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found');
if (empty($package)) {
$options = $input->getOptions();
if (isset($options['working-dir'])) {
$composer_json = $options['working-dir'] . '/composer.json';
if (file_exists($composer_json)) {
$io->writeError('Package ' . $packageFilter . ' not found in ' . $composer_json);
return;
} else {
throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
}
} else {
throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
}
}
} else {
$versions = array($package->getPrettyVersion() => $package->getVersion());

Loading…
Cancel
Save