Version 1
[yaffs-website] / vendor / drupal / console-core / src / Helper / DrupalChoiceQuestionHelper.php
diff --git a/vendor/drupal/console-core/src/Helper/DrupalChoiceQuestionHelper.php b/vendor/drupal/console-core/src/Helper/DrupalChoiceQuestionHelper.php
new file mode 100644 (file)
index 0000000..788a81d
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Console\Core\Helper\DrupalChoiceQuestionHelper.
+ */
+
+namespace Drupal\Console\Core\Helper;
+
+use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Question\Question;
+
+/**
+ * Class DrupalChoiceQuestionHelper
+ * @package Drupal\Console\Core\Helper
+ */
+class DrupalChoiceQuestionHelper extends SymfonyQuestionHelper
+{
+    /**
+     * {@inheritdoc}
+     */
+    protected function writePrompt(OutputInterface $output, Question $question)
+    {
+        $text = $question->getQuestion();
+        $default = $question->getDefault();
+        $choices = $question->getChoices();
+
+        $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
+
+        $output->writeln($text);
+
+        $output->write(' > ');
+    }
+}