public function completeCommand()
    {
        $arguments = array_slice($GLOBALS['argv'], 3);
        $position = (int)$arguments[0];

        $arguments = array_slice($arguments, 1);

        $count = count($arguments);

        $controller = null;
        if ($count > 1) {
            $controller = $arguments[1];
        }

        $command = null;
        if ($count > 2) {
            $command = $arguments[2];
            if ($command !== '' && $command[0] === '-') {
                $command = 'default';
            }
        }

        $previous = $position > 0 ? $arguments[$position - 1] : null;

        $current = isset($arguments[$position]) ? $arguments[$position] : '';

        if ($position === 1) {
            $words = $this->_getControllers();
        } elseif ($current !== '' && $current[0] === '-') {
            $words = $this->_getArgumentNames($controller, $command);
        } elseif ($position === 2) {
            $words = $this->_getCommands($controller);
        } else {
            $words = $this->_getArgumentValues($controller, $command, $previous);
        }

        $this->console->writeLn(implode(' ', $this->_filterWords($words, $current)));

        return 0;
    }
public function completeCommand()
    {
        $arguments = array_slice($GLOBALS['argv'], 3);
        $position = (int)$arguments[0];

        $arguments = array_slice($arguments, 1);

        $count = count($arguments);

        $controller = null;
        if ($count > 1) {
            $controller = $arguments[1];
        }

        $command = null;
        if ($count > 2) {
            $command = $arguments[2];
            if ($command !== '' && $command[0] === '-') {
                $command = 'default';
            }
        }

        $previous = $position > 0 ? $arguments[$position - 1] : null;

        $current = isset($arguments[$position]) ? $arguments[$position] : '';

        if ($position === 1) {
            $words = $this->_getControllers();
        } elseif ($current !== '' && $current[0] === '-') {
            $words = $this->_getArgumentNames($controller, $command);
        } elseif ($position === 2) {
            $words = $this->_getCommands($controller);
        } else {
            $words = $this->_getArgumentValues($controller, $command, $previous);
        }

        $this->console->writeLn(implode(' ', $this->_filterWords($words, $current)));

        return 0;
    }
public function completeCommand ( ) { $ arguments = array_slice ( $ GLOBALS [ 'argv' ] , 3 ) ; $ position = ( int ) $ arguments [ 0 ] ; $ arguments = array_slice ( $ arguments , 1 ) ; $ count = count ( $ arguments ) ; $ controller = null ; if ( $ count > 1 ) { $ controller = $ arguments [ 1 ] ; } $ command = null ; if ( $ count > 2 ) { $ command = $ arguments [ 2 ] ; if ( $ command !== '' && $ command [ 0 ] === '-' ) { $ command = 'default' ; } } $ previous = $ position > 0 ? $ arguments [ $ position - 1 ] : null ; $ current = isset ( $ arguments [ $ position ] ) ? $ arguments [ $ position ] : '' ; if ( $ position === 1 ) { $ words = $ this -> _getControllers ( ) ; } elseif ( $ current !== '' && $ current [ 0 ] === '-' ) { $ words = $ this -> _getArgumentNames ( $ controller , $ command ) ; } elseif ( $ position === 2 ) { $ words = $ this -> _getCommands ( $ controller ) ; } else { $ words = $ this -> _getArgumentValues ( $ controller , $ command , $ previous ) ; } $ this -> console -> writeLn ( implode ( ' ' , $ this -> _filterWords ( $ words , $ current ) ) ) ; return 0 ; }
complete for bash

@return int
complete for bash