From 202ca605591e9f326fcfcf490a6ffde1e31110e9 Mon Sep 17 00:00:00 2001 From: digitalkaoz Date: Fri, 9 Mar 2012 20:29:03 +0100 Subject: [PATCH] modified search listing (grouping packages) --- src/Composer/Command/SearchCommand.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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