1
0
Fork 0

Merge remote-tracking branch 'digitalkaoz/issue_366'

pull/398/merge
Jordi Boggiano 2012-03-10 00:17:14 +01:00
commit 4f61ec6600
1 changed files with 15 additions and 10 deletions

View File

@ -56,26 +56,31 @@ EOT
} }
$tokens = array_map('strtolower', $input->getArgument('tokens')); $tokens = array_map('strtolower', $input->getArgument('tokens'));
$packages = array();
foreach ($repos->getPackages() as $package) { foreach ($repos->getPackages() as $package) {
foreach ($tokens as $token) { foreach ($tokens as $token) {
if (false === ($pos = strpos($package->getName(), $token))) { if (false === ($pos = strpos($package->getName(), $token)) && (false === strpos(join(',',$package->getKeywords() ?: array()), $token))) {
continue; continue;
} }
if ($platformRepo->hasPackage($package)) { if (false !== ($pos = strpos($package->getName(), $token))) {
$type = '<info>platform: </info> ';
} elseif ($installedRepo->hasPackage($package)) {
$type = '<info>installed:</info> ';
} else {
$type = '<comment>available:</comment> ';
}
$name = substr($package->getPrettyName(), 0, $pos) $name = substr($package->getPrettyName(), 0, $pos)
. '<highlight>' . substr($package->getPrettyName(), $pos, strlen($token)) . '</highlight>' . '<highlight>' . substr($package->getPrettyName(), $pos, strlen($token)) . '</highlight>'
. substr($package->getPrettyName(), $pos + strlen($token)); . substr($package->getPrettyName(), $pos + strlen($token));
$output->writeln($type . ': ' . $name . ' <comment>' . $package->getPrettyVersion() . '</comment>'); } else {
$name = $package->getPrettyName();
}
$version = $installedRepo->hasPackage($package) ? '<info>'.$package->getPrettyVersion().'</info>' : $package->getPrettyVersion();
$packages[$name][$package->getPrettyVersion()] = $version;
continue 2; continue 2;
} }
} }
foreach ($packages as $name => $versions) {
$output->writeln($name .' <comment>:</comment> '. join(', ', $versions));
}
} }
} }