public static function select($prompt, $options = [])
    {
        $helpText = '';
        foreach ($options as $key => $value) {
            $helpText .= " $key - $value\n";
        }
        $helpText .= ' ? - Show help';
        $promptText = "$prompt [" . implode(',', array_keys($options)) . ',?]: ';
        $promptOptions = [
            'required' => true,
            'validator' => function($input, &$error) use($options, $helpText) {
                $input = trim($input);
                if ($input === '?') {
                    $error = $helpText;
                    return false;
                }
                if (array_key_exists($input, $options)) {
                    return true;
                }

                $error = "Invalid input, please enter '?' for help";
                return false;
            }
        ];
        return static::prompt($promptText, $promptOptions);
    }
public static function select($prompt, $options = [])
    {
        $helpText = '';
        foreach ($options as $key => $value) {
            $helpText .= " $key - $value\n";
        }
        $helpText .= ' ? - Show help';
        $promptText = "$prompt [" . implode(',', array_keys($options)) . ',?]: ';
        $promptOptions = [
            'required' => true,
            'validator' => function($input, &$error) use($options, $helpText) {
                $input = trim($input);
                if ($input === '?') {
                    $error = $helpText;
                    return false;
                }
                if (array_key_exists($input, $options)) {
                    return true;
                }

                $error = "Invalid input, please enter '?' for help";
                return false;
            }
        ];
        return static::prompt($promptText, $promptOptions);
    }
public static function select ( $ prompt , $ options = [ ] ) { $ helpText = '' ; foreach ( $ options as $ key => $ value ) { $ helpText .= " $key - $value\n" ; } $ helpText .= ' ? - Show help' ; $ promptText = "$prompt [" . implode ( ',' , array_keys ( $ options ) ) . ',?]: ' ; $ promptOptions = [ 'required' => true , 'validator' => function ( $ input , & $ error ) use ( $ options , $ helpText ) { $ input = trim ( $ input ) ; if ( $ input === '?' ) { $ error = $ helpText ; return false ; } if ( array_key_exists ( $ input , $ options ) ) { return true ; } $ error = "Invalid input, please enter '?' for help" ; return false ; } ] ; return static :: prompt ( $ promptText , $ promptOptions ) ; }
Gives the user an option to choose from. Giving '?' as an input will show
a list of options to choose from and their explanations.

@param string $prompt the prompt message
@param array $options Key-value array of options to choose from. Key is what is inputed and used, value is
what's displayed to end user by help command.

@return ExtendedPromiseInterface with string An option character the user chose
Gives the user an option to choose from . Giving ? as an input will show a list of options to choose from and their explanations .