From c58b7d917c65692eeb00c22b2fbaaa251cb390dc Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 5 Jan 2015 16:31:16 +0000 Subject: [PATCH] Disable progress when no-ansi is specified, refs #3612 --- src/Composer/Command/Command.php | 14 ++++++++++++++ src/Composer/Command/ConfigCommand.php | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/Command.php index b99686219..6c5226c6a 100644 --- a/src/Composer/Command/Command.php +++ b/src/Composer/Command/Command.php @@ -16,6 +16,8 @@ use Composer\Composer; use Composer\Console\Application; use Composer\IO\IOInterface; use Composer\IO\NullIO; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command as BaseCommand; /** @@ -102,4 +104,16 @@ abstract class Command extends BaseCommand { $this->io = $io; } + + /** + * {@inheritDoc} + */ + protected function initialize(InputInterface $input, OutputInterface $output) + { + if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) { + $input->setOption('no-progress', true); + } + + parent::initialize($input, $output); + } } diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 832571b3f..4d52c8473 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -100,6 +100,8 @@ EOT */ protected function initialize(InputInterface $input, OutputInterface $output) { + parent::initialize($input, $output); + if ($input->getOption('global') && 'composer.json' !== $input->getOption('file')) { throw new \RuntimeException('--file and --global can not be combined'); }