Skip to content

Commit

Permalink
Add support of multiple values for breakpoints option, when we use in…
Browse files Browse the repository at this point in the history
…line options (#3713)
  • Loading branch information
LOBsTerr authored and jmolivas committed Jan 22, 2018
1 parent 7f8a6eb commit 46c6303
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Command/Generate/BreakPointCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Drupal\Console\Command\Generate;

use Drupal\Console\Command\Shared\ArrayInputTrait;
use Drupal\Console\Command\Shared\ConfirmationTrait;
use Drupal\Console\Command\Shared\ThemeBreakpointTrait;
use Drupal\Console\Core\Command\Command;
Expand All @@ -27,6 +28,7 @@ class BreakPointCommand extends Command
{
use ConfirmationTrait;
use ThemeBreakpointTrait;
use ArrayInputTrait;

/**
* @var BreakPointGenerator
Expand Down Expand Up @@ -100,7 +102,7 @@ protected function configure()
->addOption(
'breakpoints',
null,
InputOption::VALUE_OPTIONAL,
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
$this->trans('commands.generate.breakpoint.options.breakpoints')
)->setAliases(['gb']);
}
Expand All @@ -120,6 +122,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$machine_name = $validators->validateMachineName($input->getOption('theme'));
$theme = $input->getOption('theme');
$breakpoints = $input->getOption('breakpoints');
$noInteraction = $input->getOption('no-interaction');
// Parse nested data.
if ($noInteraction) {
$breakpoints = $this->explodeInlineArray($breakpoints);
}

$this->generator->generate(
$theme,
Expand Down Expand Up @@ -157,6 +164,9 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$breakpoints) {
$breakpoints = $this->breakpointQuestion();
$input->setOption('breakpoints', $breakpoints);
} else {
$breakpoints = $this->explodeInlineArray($breakpoints);
}
$input->setOption('breakpoints', $breakpoints);
}
}

0 comments on commit 46c6303

Please sign in to comment.