diff --git a/src/Command/Shared/InputTrait.php b/src/Command/Shared/InputTrait.php index 5d0907f..725a0a3 100644 --- a/src/Command/Shared/InputTrait.php +++ b/src/Command/Shared/InputTrait.php @@ -10,7 +10,7 @@ /** * Class InputTrait * - * @package Drupal\Console\Core\Command + * @package Drupal\Console\Core\Command\Shared */ trait InputTrait { @@ -19,19 +19,17 @@ trait InputTrait */ private function inlineValueAsArray($inputValue) { - $inputArrayValue = []; + $inputAsArray = []; foreach ($inputValue as $key => $value) { if (!is_array($value)) { - $separatorIndex = strpos($value, ':'); - if (!$separatorIndex) { + try { + $inputAsArray[] = json_decode('[{'.$value.'}]', true)[0]; + } catch (\Exception $e) { continue; } - $inputKeyItem = substr($value, 0, $separatorIndex); - $inputValueItem = substr($value, $separatorIndex+1); - $inputArrayValue[$key] = [$inputKeyItem => $inputValueItem]; } } - return $inputArrayValue?$inputArrayValue:$inputValue; + return $inputAsArray?$inputAsArray:$inputValue; } } diff --git a/src/EventSubscriber/ShowGenerateChainListener.php b/src/EventSubscriber/ShowGenerateChainListener.php index ee4704b..5e636ba 100644 --- a/src/EventSubscriber/ShowGenerateChainListener.php +++ b/src/EventSubscriber/ShowGenerateChainListener.php @@ -43,7 +43,8 @@ class ShowGenerateChainListener implements EventSubscriberInterface private $skipOptions = [ 'env', 'generate-inline', - 'generate-chain' + 'generate-chain', + 'no-interaction' ]; /** diff --git a/src/EventSubscriber/ShowGenerateInlineListener.php b/src/EventSubscriber/ShowGenerateInlineListener.php index 90ea4b2..f4a7162 100644 --- a/src/EventSubscriber/ShowGenerateInlineListener.php +++ b/src/EventSubscriber/ShowGenerateInlineListener.php @@ -42,7 +42,8 @@ class ShowGenerateInlineListener implements EventSubscriberInterface private $skipOptions = [ 'env', 'generate-inline', - 'generate-chain' + 'generate-chain', + 'no-interaction' ]; /** @@ -115,9 +116,9 @@ public function showGenerateInline(ConsoleTerminateEvent $event) foreach ($optionValue as $optionItem) { if (is_array($optionItem)) { $inlineValue = implode( - ' ', array_map( + ', ', array_map( function ($v, $k) { - return $k . ':' . $v; + return '"'.$k . '":"' . $v . '"'; }, $optionItem, array_keys($optionItem) @@ -126,7 +127,7 @@ function ($v, $k) { } else { $inlineValue = $optionItem; } - $inline .= ' --' . $optionName . '="' . $inlineValue . '"'; + $inline .= ' --' . $optionName . '=\'' . $inlineValue . '\''; } } else { if (is_bool($optionValue)) { @@ -144,7 +145,7 @@ function ($v, $k) { $io->writeln( sprintf( - '$ drupal %s %s', + '$ drupal %s %s --no-interaction', $command_name, $inline )