浏览代码

cleaner solution

Rob Bast 9 年之前
父节点
当前提交
dfbee6a532
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/Composer/Command/ShowCommand.php

+ 3 - 4
src/Composer/Command/ShowCommand.php

@@ -196,13 +196,12 @@ EOT
                     $width--;
                 }
 
-                $writePath = !$input->getOption('name-only') && $input->getOption('path');
-
-                if ($writePath && null === $composer) {
+                if ($input->getOption('path') && null === $composer) {
                     $this->getIO()->writeError('No composer.json found in the current directory, disabling "path" option');
-                    $writePath = false;
+                    $input->setOption('path', false);
                 }
 
+                $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) {