Browse Source

Disable progress when no-ansi is specified, refs #3612

Jordi Boggiano 10 years ago
parent
commit
c58b7d917c
2 changed files with 16 additions and 0 deletions
  1. 14 0
      src/Composer/Command/Command.php
  2. 2 0
      src/Composer/Command/ConfigCommand.php

+ 14 - 0
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);
+    }
 }

+ 2 - 0
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');
         }