/** * Generate tab completion strings. * * ## OPTIONS * * --line=<line> * : The current command line to be executed * * [--point=<point>] * : The index to the current cursor position relative to the beginning of * the command */ public function completions($args, $assoc_args) { $line = $assoc_args['line']; if (isset($assoc_args['point'])) { $line = substr($line, 0, $assoc_args['point']); } $compl = new Terminus\Completions($line); $compl->render(); }
/** * Generate tab completion strings. * * ## OPTIONS * * --line=<line> * : The current command line to be executed * * [--point=<point>] * : The index to the current cursor position relative to the beginning of * the command */ public function completions($args, $assoc_args) { $line = $assoc_args['line']; if (isset($assoc_args['point'])) { $line = substr($line, 0, $assoc_args['point']); } $completions = new Completions($line); $options = $completions->getOptions(); foreach ($options as $option) { $this->output()->line($option); } }
public function testGetOptions() { $options = $this->completions->getOptions(); $this->assertTrue(in_array('--format=', $options)); }
public function testRender() { $this->completions->render(); $output = retrieveOutput(); $this->assertTrue(strpos($output, '--format=') !== false); }