From f748fb1953175dca9b9f6268057f6b0ef0cb0790 Mon Sep 17 00:00:00 2001 From: "go.schmidt" Date: Wed, 28 Nov 2012 11:46:33 +0100 Subject: [PATCH] fixed version output for show command --- src/Composer/Command/ShowCommand.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 49905aa7a..32eb4f36c 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -258,13 +258,19 @@ EOT } uasort($versions, 'version_compare'); - $versions = implode(', ', array_keys(array_reverse($versions))); + $versions = array_keys(array_reverse($versions)); // highlight installed version if ($installedRepo->hasPackage($package)) { - $versions = str_replace($package->getPrettyVersion(), '* ' . $package->getPrettyVersion() . '', $versions); + $installedVersion = $package->getPrettyVersion(); + $key = array_search($installedVersion, $versions); + if (FALSE !== $key) { + $versions[$key] = '* ' . $installedVersion . ''; + } } + $versions = implode(', ', $versions); + $output->writeln('versions : ' . $versions); }