Merge remote-tracking branch 'iambrosi/show-command-dev'
commit
5083f4c685
|
@ -42,6 +42,7 @@ class ShowCommand extends Command
|
||||||
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
|
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
|
||||||
new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform 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('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
|
->setHelp(<<<EOT
|
||||||
The show command displays detailed information about a package, or
|
The show command displays detailed information about a package, or
|
||||||
|
@ -56,16 +57,25 @@ EOT
|
||||||
{
|
{
|
||||||
// init repos
|
// init repos
|
||||||
$platformRepo = new PlatformRepository;
|
$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')) {
|
if ($input->getOption('self')) {
|
||||||
$package = $this->getComposer(false)->getPackage();
|
$package = $this->getComposer(false)->getPackage();
|
||||||
$repos = $installedRepo = new ArrayRepository(array($package));
|
$repos = $installedRepo = new ArrayRepository(array($package));
|
||||||
} elseif ($input->getOption('platform')) {
|
} elseif ($input->getOption('platform')) {
|
||||||
$repos = $installedRepo = $platformRepo;
|
$repos = $installedRepo = $platformRepo;
|
||||||
} elseif ($input->getOption('installed')) {
|
} elseif ($input->getOption('installed')) {
|
||||||
$composer = $this->getComposer();
|
$repos = $installedRepo = $getRepositories($this->getComposer(), $input->getOption('dev'));
|
||||||
$repos = $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
|
|
||||||
} elseif ($composer = $this->getComposer(false)) {
|
} elseif ($composer = $this->getComposer(false)) {
|
||||||
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
|
$localRepo = $getRepositories($composer, $input->getOption('dev'));
|
||||||
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
|
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
|
||||||
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
|
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue