Input/Keyboard.php
/**
     * Calls the autocomplete callback and filters the result for
     * printing.
     *
     * @param string $input
     * @access protected
     * @return string
     */
Calls the autocomplete callback and filters the result for
printing.

@param string $input
@access protected
@return string
Calls the autocomplete callback and filters the result for printing . @param string $input @access protected @return string
protected function _getAutoComplete(&$input)
    {
        if (is_callable($this->_autoComplete)) {
            $line = implode('', $input);
            $options = call_user_func($this->_autoComplete, $line);
            asort($options);
            $matching = array();
            $commands = explode(' ', $line);
            $last = array_pop($commands);
            if ($last) {
                foreach ($options as $option) {
                    if (strpos($option, $last) === 0) {
                        $matching[] = $option;
                    }
                }
            } else {
                $matching = $options;
            }
            $count = count($matching);
            if ($count == 0) {
                return "\r";
            } elseif ($count == 1) {
                $commands[] = $matching[0] . ' ';
                $input = str_split(implode(' ', $commands));
                return "\r";
            }
            return "\n" . implode(' ', $matching) . "\n";
        }
        return "\r";
    }
protected function _getAutoComplete ( & $ input ) { if ( is_callable ( $ this -> _autoComplete ) ) { $ line = implode ( '' , $ input ) ; $ options = call_user_func ( $ this -> _autoComplete , $ line ) ; asort ( $ options ) ; $ matching = array ( ) ; $ commands = explode ( ' ' , $ line ) ; $ last = array_pop ( $ commands ) ; if ( $ last ) { foreach ( $ options as $ option ) { if ( strpos ( $ option , $ last ) === 0 ) { $ matching [ ] = $ option ; } } } else { $ matching = $ options ; } $ count = count ( $ matching ) ; if ( $ count == 0 ) { return " \r " ; } elseif ( $ count == 1 ) { $ commands [ ] = $ matching [ 0 ] . ' ' ; $ input = str_split ( implode ( ' ' , $ commands ) ) ; return " \r " ; } return " \n " . implode ( ' ' , $ matching ) . " \n " ; } return " \r " ; }
Calls the autocomplete callback and filters the result for
 printing.
Calls the autocomplete callback and filters the result for printing .