From 527f5b85714bf3aee85bd2e64351c77c84533e02 Mon Sep 17 00:00:00 2001 From: Alexander Schwenn Date: Mon, 6 Mar 2017 00:29:20 +0100 Subject: [PATCH] Print error message when json is requested for tree or single package info --- src/Composer/Command/ShowCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 94f2bcabb..6a492fd80 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -172,6 +172,9 @@ EOT // show single package or single version if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) { + if ('json' === $format) { + $io->writeError('Format "json" is only supported for package listings, falling back to format "text"'); + } if (empty($package)) { list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version')); @@ -214,6 +217,9 @@ EOT // show tree view if requested if ($input->getOption('tree')) { + if ('json' === $format) { + $io->writeError('Format "json" is only supported for package listings, falling back to format "text"'); + } $rootRequires = $this->getRootRequires(); foreach ($installedRepo->getPackages() as $package) { if (in_array($package->getName(), $rootRequires, true)) {