Handle default command arguments, fixes #409
This commit is contained in:
bovenliggende
4cdb7f6fd1
commit
2d451be104
@ -1,5 +1,7 @@
|
|||||||
<?php namespace Todaymade\Daux\Console;
|
<?php namespace Todaymade\Daux\Console;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -31,6 +33,17 @@ class Generate extends DauxCommand
|
|||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
// When used as a default command,
|
||||||
|
// Symfony doesn't read the default parameters.
|
||||||
|
// This will parse the parameters
|
||||||
|
if ($input instanceof ArrayInput) {
|
||||||
|
$argv = $_SERVER['argv'];
|
||||||
|
$argv[0] = $this->getName();
|
||||||
|
array_unshift($argv, 'binary_name');
|
||||||
|
|
||||||
|
$input = new ArgvInput($argv, $this->getDefinition());
|
||||||
|
}
|
||||||
|
|
||||||
$daux = $this->prepareDaux($input);
|
$daux = $this->prepareDaux($input);
|
||||||
|
|
||||||
$width = $this->getApplication()->getTerminalDimensions()[0];
|
$width = $this->getApplication()->getTerminalDimensions()[0];
|
||||||
|
Laden…
Verwijs in nieuw issue
Block a user