1
0
Fork 0

Merge remote-tracking branch 'alebiavati/list-paths'

pull/2737/merge
Jordi Boggiano 2014-03-09 16:09:15 +01:00
commit aa9c257f0e
1 changed files with 9 additions and 2 deletions

View File

@ -50,6 +50,7 @@ class ShowCommand extends Command
new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available 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'), new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'), new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The show command displays detailed information about a package, or The show command displays detailed information about a package, or
@ -193,8 +194,9 @@ EOT
$width--; $width--;
} }
$writeVersion = !$input->getOption('name-only') && $showVersion && ($nameLength + $versionLength + 3 <= $width); $writePath = !$input->getOption('name-only') && $input->getOption('path');
$writeDescription = !$input->getOption('name-only') && ($nameLength + ($showVersion ? $versionLength : 0) + 24 <= $width); $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion && ($nameLength + $versionLength + 3 <= $width);
$writeDescription = !$input->getOption('name-only') && !$input->getOption('path') && ($nameLength + ($showVersion ? $versionLength : 0) + 24 <= $width);
foreach ($packages[$type] as $package) { foreach ($packages[$type] as $package) {
if (is_object($package)) { if (is_object($package)) {
$output->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false); $output->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false);
@ -211,6 +213,11 @@ EOT
} }
$output->write(' ' . $description); $output->write(' ' . $description);
} }
if ($writePath) {
$path = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
$output->write(' ' . $path);
}
} else { } else {
$output->write($indent . $package); $output->write($indent . $package);
} }