From c7deaa8a1f3a6003392396c8d9ed2c73c588bde7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 6 Dec 2011 23:07:06 +0100 Subject: [PATCH] Add highlight style --- src/Composer/Console/Application.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index df919dc80..c0871bf4b 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -15,6 +15,9 @@ namespace Composer\Console; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Finder\Finder; use Composer\Command; use Composer\Composer; @@ -40,12 +43,21 @@ class Application extends BaseApplication } /** - * Runs the current application. - * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * - * @return integer 0 if everything went fine, or an error code + * {@inheritDoc} + */ + public function run(InputInterface $input = null, OutputInterface $output = null) + { + if (null === $output) { + $styles['highlight'] = new OutputFormatterStyle('red'); + $formatter = new OutputFormatter(null, $styles); + $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter); + } + + return parent::run($input, $output); + } + + /** + * {@inheritDoc} */ public function doRun(InputInterface $input, OutputInterface $output) {