1
0
Fork 0

Show reference as well in show command overview

pull/1410/head
Jordi Boggiano 2012-12-08 21:03:32 +01:00
parent 35afd0a78e
commit 9b2e3766c0
1 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,8 @@ use Composer\Repository\RepositoryInterface;
*/ */
class ShowCommand extends Command class ShowCommand extends Command
{ {
protected $versionParser;
protected function configure() protected function configure()
{ {
$this $this
@ -55,6 +57,8 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$this->versionParser = new VersionParser;
// init repos // init repos
$platformRepo = new PlatformRepository; $platformRepo = new PlatformRepository;
$getRepositories = function (Composer $composer, $dev) { $getRepositories = function (Composer $composer, $dev) {
@ -136,7 +140,7 @@ EOT
$output->writeln($type); $output->writeln($type);
ksort($packages[$type]); ksort($packages[$type]);
foreach ($packages[$type] as $package) { foreach ($packages[$type] as $package) {
$output->writeln(' '.$package->getPrettyName() .' '.($showVersion ? '['.$package->getPrettyVersion().']' : '').' <comment>:</comment> '. strtok($package->getDescription(), "\r\n")); $output->writeln(' '.$package->getPrettyName() .' '.($showVersion ? '['.$this->versionParser->formatVersion($package).']' : '').' <comment>:</comment> '. strtok($package->getDescription(), "\r\n"));
} }
$output->writeln(''); $output->writeln('');
} }
@ -157,8 +161,7 @@ EOT
{ {
$name = strtolower($name); $name = strtolower($name);
if ($version) { if ($version) {
$parser = new VersionParser(); $version = $this->versionParser->normalize($version);
$version = $parser->normalize($version);
} }
$match = null; $match = null;