diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php
index d01ebc1b4..a2006eaca 100644
--- a/src/Composer/Command/SearchCommand.php
+++ b/src/Composer/Command/SearchCommand.php
@@ -56,26 +56,26 @@ EOT
}
$tokens = array_map('strtolower', $input->getArgument('tokens'));
+ $packages = array();
+
foreach ($repos->getPackages() as $package) {
foreach ($tokens as $token) {
if (false === ($pos = strpos($package->getName(), $token))) {
continue;
}
- if ($platformRepo->hasPackage($package)) {
- $type = 'platform: ';
- } elseif ($installedRepo->hasPackage($package)) {
- $type = 'installed: ';
- } else {
- $type = 'available: ';
- }
-
$name = substr($package->getPrettyName(), 0, $pos)
. '' . substr($package->getPrettyName(), $pos, strlen($token)) . ''
. substr($package->getPrettyName(), $pos + strlen($token));
- $output->writeln($type . ': ' . $name . ' ' . $package->getPrettyVersion() . '');
+ $version = $installedRepo->hasPackage($package) ? ''.$package->getPrettyVersion().'' : $package->getPrettyVersion();
+
+ $packages[$name][$package->getPrettyVersion()] = $version;
continue 2;
}
}
+
+ foreach ($packages as $name => $versions) {
+ $output->writeln($name .' : '. join(', ', $versions));
+ }
}
}
\ No newline at end of file