function readline_completion_impl($string, $index) { $readline_info = readline_info(); $line = substr($readline_info['line_buffer'], 0, $readline_info['end']); $parts = Helper_Common::parseCommand($line); $candidates = array(); if (empty($parts)) { // no input yet, just return list of helper functions $candidates += array_keys($GLOBALS['HELPERS']); } else { if (isset($GLOBALS['HELPERS'][$parts[0]])) { // we actually got the helper function correctly $PARAMS = array_slice($parts, 1); $IS_COMPLETION = true; require $GLOBALS['HELPERS'][$parts[0]]; } else { // incomplete helper function... $candidates += array_keys($GLOBALS['HELPERS']); } } return $candidates; }