Browse Source

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

Jordi Boggiano 11 years ago
parent
commit
aa9c257f0e
1 changed files with 9 additions and 2 deletions
  1. 9 2
      src/Composer/Command/ShowCommand.php

+ 9 - 2
src/Composer/Command/ShowCommand.php

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