Merge branch '1.6'
commit
015927d0b0
|
@ -19,6 +19,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Helper\Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Fabien Potencier <fabien.potencier@gmail.com>
|
* @author Fabien Potencier <fabien.potencier@gmail.com>
|
||||||
|
@ -68,7 +69,7 @@ EOT
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if ($input->getOption('list')) {
|
if ($input->getOption('list')) {
|
||||||
return $this->listScripts();
|
return $this->listScripts($output);
|
||||||
} elseif (!$input->getArgument('script')) {
|
} elseif (!$input->getArgument('script')) {
|
||||||
throw new \RuntimeException('Missing required argument "script"');
|
throw new \RuntimeException('Missing required argument "script"');
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,7 @@ EOT
|
||||||
return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
|
return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function listScripts()
|
protected function listScripts(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$scripts = $this->getComposer()->getPackage()->getScripts();
|
$scripts = $this->getComposer()->getPackage()->getScripts();
|
||||||
|
|
||||||
|
@ -111,9 +112,21 @@ EOT
|
||||||
|
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$io->writeError('<info>scripts:</info>');
|
$io->writeError('<info>scripts:</info>');
|
||||||
|
$table = array();
|
||||||
foreach ($scripts as $name => $script) {
|
foreach ($scripts as $name => $script) {
|
||||||
$io->write(' ' . $name);
|
$cmd = $this->getApplication()->find($name);
|
||||||
|
$description = '';
|
||||||
|
if ($cmd instanceof ScriptAliasCommand) {
|
||||||
|
$description = $cmd->getDescription();
|
||||||
}
|
}
|
||||||
|
$table[] = array(' '.$name, $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
$renderer = new Table($output);
|
||||||
|
$renderer->setStyle('compact');
|
||||||
|
$renderer->getStyle()->setVerticalBorderChar('');
|
||||||
|
$renderer->getStyle()->setCellRowContentFormat('%s ');
|
||||||
|
$renderer->setRows($table)->render();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue