1
0
Fork 0

Move creation of custom styles to the factory

pull/1288/head
Jordi Boggiano 2012-11-05 13:51:43 +01:00
parent 0c61e9d345
commit aecf4ffe91
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,6 @@ use Symfony\Component\Console\Input\InputOption;
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 Composer\Command;
use Composer\Command\Helper\DialogHelper;
use Composer\Composer;
@ -63,8 +62,7 @@ class Application extends BaseApplication
public function run(InputInterface $input = null, OutputInterface $output = null)
{
if (null === $output) {
$styles['highlight'] = new OutputFormatterStyle('red');
$styles['warning'] = new OutputFormatterStyle('black', 'yellow');
$styles = Factory::createAdditionalStyles();
$formatter = new OutputFormatter(null, $styles);
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
}

View File

@ -19,6 +19,7 @@ use Composer\Repository\ComposerRepository;
use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
/**
* Creates a configured instance of composer.
@ -70,6 +71,14 @@ class Factory
return getenv('COMPOSER') ?: 'composer.json';
}
public static function createAdditionalStyles()
{
return array(
'highlight' => new OutputFormatterStyle('red'),
'warning' => new OutputFormatterStyle('black', 'yellow'),
);
}
public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
{
$repos = array();