Ask a question where some auto-completion help is provided.

@param string     $question
@param array      $autoCompletion
@param mixed|null $default

@return mixed
10772
public function anticipate($question, array $autoCompletion, $default = null)
    {
        $helper = $this->getHelper('question');

        $question = new Question($question, $default);

        $question->setAutocompleterValues($autoCompletion);

        return $helper->ask($this->input, $this->getOutputInterface(), $question);
    }
353539
public function ask(string $question, $default = 'n', ?array $options = null)
	{
		$options = $options === null ? ['y' => true, 'n' => false] : $this->normalizeKeys($options);

		$input = parent::ask(trim($question) . ' [' . $this->getOptions($options, $default) . '] ');

		$input = mb_strtolower(empty($input) ? $default : $input);

		if(!isset($options[$input]))
		{
			return $this->ask($question, $default, $options);
		}

		return $options[$input];
	}
453918
public function choose($question, array $options, $default, $error_message)
	{
		/** @var QuestionHelper $helper */
		$helper = $this->_helperSet->get('question');
		$choice_question = new ChoiceQuestion('<question>' . $question . '</question> ', $options, $default);
		$choice_question->setErrorMessage($error_message);

		return $helper->ask($this->_input, $this->_output, $choice_question);
	}
900495
public function confirm($questionText, $default = true)
    {
        $questionText .= ' <question>' . ($default ? '[Y/n]' : '[y/N]') . '</question> ';

        $yes = $this->input->hasOption('yes') && $this->input->getOption('yes');
        $no = $this->input->hasOption('no') && $this->input->getOption('no');
        if ($yes && !$no) {
            $this->output->writeln($questionText . 'y');
            return true;
        } elseif ($no && !$yes) {
            $this->output->writeln($questionText . 'n');
            return false;
        } elseif (!$this->input->isInteractive()) {
            $this->output->writeln($questionText . ($default ? 'y' : 'n'));
            return $default;
        }
        $question = new ConfirmationQuestion($questionText, $default);

        return $this->ask($this->input, $this->output, $question);
    }
176002
final protected function confirm($question, $defaultValue = true)
    {
        $indent = ($this->indent > 0) ? $this->indent : 0;
        $prompt = sprintf(' [<info>%s</info>]', $defaultValue ? 'yes' : 'no');
        $question = sprintf('%s%s%s: ', str_repeat(' ', 4 * $indent), $question, $prompt);

        $question = new ConfirmationQuestion($question, $defaultValue);
        return $this->getHelper('question')->ask($this->input, $this->output, $question);
    }
732766
public function confirm($question, $default = false)
    {
        $que = new ConfirmationQuestion($question, $default);
        $helper = new SymfonyQuestionHelper();
        return $helper->ask($this->input, $this->output, $que);
    }
916736
protected function askChoice($question, $options, $default = NULL) {
    return $this->doAsk(new ChoiceQuestion($this->formatQuestion($question),
      $options, $default));
  }
1064989
public function ask($question, $isHidden = false, $default = '', $displayDefault = true)
    {
        if ($displayDefault && !empty($default)) {
            $defaultText = $default;
            if (strlen($defaultText) > 30) {
                $defaultText = substr($default, 0, 30) . '...';
            }
            $question .= " [$defaultText]";
        }
        Output::write("$question ");
        return ($isHidden ? $this->askHidden() : trim(fgets(STDIN))) ?: $default;
    }
1374719
public function prompt($question, $default = null, $marker = ': ')
    {
        if (isset($default) && strpos($question, '[') === false) {
            $question .= ' [default: ' . $default . ']';
        }

        $this->out($question . $marker);

        $input = $this->in();

        if ($input === '') {
            return $default;
        }

        return $input;
    }
1117689
protected function askYesNo(string $description, boolean $default)
    {
        $helper   = $this->getHelper('question');
        $question = new ConfirmationQuestion($description, $default);

        return $helper->ask($this->input, $this->output, $question);
    }
555193
def prompt_autocomplete(prompt, complete, default=None, contains_spaces=True, 
                        show_default=True, prompt_suffix=': ', color=None):
    

    def real_completer(text, state):
        possibilities = complete(text) + [None]

        if possibilities:
            return possibilities[state]
        return None

    readline.set_completer_delims('\t\n' + ' ' * (not contains_spaces))
    readline.parse_and_bind("tab: complete")
    readline.set_completer(real_completer)
    
    if default is not None and show_default:
        prompt += ' [%s]' % default

    prompt += prompt_suffix

    colors = {
        'red': Fore.RED,
        'blue': Fore.BLUE,
        'green': Fore.GREEN,
        'cyan': Fore.CYAN,
        'magenta': Fore.MAGENTA,
        'yellow': Fore.YELLOW,
        'white': Fore.WHITE,
        'black': Fore.LIGHTBLACK_EX
    }

    if color:
        prompt = colors[color.lower()] + prompt + Fore.RESET

    if default is not None:
        r = input(prompt)
    else:
        while True:
            r = input(prompt)
            if r:
                break

    r = r or default

    # remove the autocompletion before quitting for future input()
    readline.parse_and_bind('tab: self-insert')
    readline.set_completer(None)

    return r
1268987
protected function secret(string $question, $default = null, bool $fallback = false)
	{
		return (new Secret($this->input, $this->output))->ask($question, $default, $fallback);
	}
567588
protected function getFormattedSimpleQuestion($question, $default, array $options)
    {
        $question .= '%s';
        $question = sprintf(
            $question,
            ($options ? ' ('.implode('/', $options).')' : '')
        );

        return $question;
    }
608679
public function ask(string $name, string $question, string $default = '', bool $required = false)
    {
        $count = 0;
        $maxAsks = 3;

        while ($count++ < $maxAsks) {
            $response = $this->in($question, $default);

            if (!$required || !empty($response)) {
                return $response;
            }

            $this->handler->out('A response is required...');
        }

        throw new AskException($name, $maxAsks);
    }
391394
public function autocomplete($attachTo=NULL, $params=NULL) {
		return $this->addComponent(new Autocomplete($this->js), $attachTo, $params);
	}
825509
public function askQuestion($message, $default = null)
    {
        $question = new Question($this->formatMessage($message, $default), $default);
        
        return $this->question->ask($this->input, $this->output, $question);
    }
135938
public function choose($question, array $choices, $default = null)
    {
        $helper = $this->getHelper('question');

        $question = new ChoiceQuestion($question, $choices, $default);

        $question->setErrorMessage('Option %s is invalid.');

        return $helper->ask($this->input, $this->getOutputInterface(), $question);
    }