1
0
Fork 0

Merge remote-tracking branch 'iambrosi/show-command-dev'

pull/1200/head
Jordi Boggiano 2012-10-10 13:57:03 +02:00
commit 5083f4c685
1 changed files with 13 additions and 3 deletions

View File

@ -42,6 +42,7 @@ class ShowCommand extends Command
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables display of dev-require packages.'),
))
->setHelp(<<<EOT
The show command displays detailed information about a package, or
@ -56,16 +57,25 @@ EOT
{
// init repos
$platformRepo = new PlatformRepository;
$getRepositories = function (Composer $composer, $dev) {
$manager = $composer->getRepositoryManager();
$repos = new CompositeRepository(array($manager->getLocalRepository()));
if ($dev) {
$repos->addRepository($manager->getLocalDevRepository());
}
return $repos;
};
if ($input->getOption('self')) {
$package = $this->getComposer(false)->getPackage();
$repos = $installedRepo = new ArrayRepository(array($package));
} elseif ($input->getOption('platform')) {
$repos = $installedRepo = $platformRepo;
} elseif ($input->getOption('installed')) {
$composer = $this->getComposer();
$repos = $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
$repos = $installedRepo = $getRepositories($this->getComposer(), $input->getOption('dev'));
} elseif ($composer = $this->getComposer(false)) {
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$localRepo = $getRepositories($composer, $input->getOption('dev'));
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
} else {