1
0
Fork 0

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
pull/6008/head
Ed Reel 2016-12-27 21:22:48 -06:00 committed by Jordi Boggiano
parent 5ecd9ace59
commit afdae9c0e2
1 changed files with 13 additions and 2 deletions

View File

@ -166,8 +166,19 @@ EOT
if (empty($package)) { if (empty($package)) {
list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version')); list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
if (!$package) { if (empty($package)) {
throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found'); $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 { } else {
$versions = array($package->getPrettyVersion() => $package->getVersion()); $versions = array($package->getPrettyVersion() => $package->getVersion());