diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php
index a4eb9a362..ce28c049f 100644
--- a/src/Composer/Command/ShowCommand.php
+++ b/src/Composer/Command/ShowCommand.php
@@ -52,7 +52,7 @@ class ShowCommand extends BaseCommand
->setDefinition(array(
new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect'),
new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
- new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
+ new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
@@ -79,9 +79,9 @@ EOT
$composer = $this->getComposer(false);
$io = $this->getIO();
- if ($input->getOption('tree') && !$input->getOption('installed')) {
- $io->writeError('The --tree (-t) option is only usable in combination with --installed (-i) or by passing a single package name to show, assuming -i');
- $input->setOption('installed', true);
+ if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
+ $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
+ return;
}
// init repos
@@ -96,8 +96,6 @@ EOT
$repos = $installedRepo = new ArrayRepository(array($package));
} elseif ($input->getOption('platform')) {
$repos = $installedRepo = $platformRepo;
- } elseif ($input->getOption('installed')) {
- $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
} elseif ($input->getOption('available')) {
$installedRepo = $platformRepo;
if ($composer) {
@@ -107,15 +105,17 @@ EOT
$repos = new CompositeRepository($defaultRepos);
$io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
}
- } elseif ($composer) {
+ } elseif ($input->getOption('all') && $composer) {
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
- } else {
+ } elseif ($input->getOption('all')) {
$defaultRepos = Factory::createDefaultRepositories($io);
$io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
$installedRepo = $platformRepo;
$repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
+ } else {
+ $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
}
if ($composer) {
@@ -209,7 +209,7 @@ EOT
}
}
- $showAllTypes = !$input->getOption('platform') && !$input->getOption('installed') && !$input->getOption('available');
+ $showAllTypes = $input->getOption('all');
$indent = $showAllTypes ? ' ' : '';
foreach (array('platform:' => true, 'available:' => false, 'installed:' => true) as $type => $showVersion) {
if (isset($packages[$type])) {