Exemple #1
0
 /**
  * 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();
 }
Exemple #2
0
 /**
  * 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));
 }
Exemple #4
0
 public function testRender()
 {
     $this->completions->render();
     $output = retrieveOutput();
     $this->assertTrue(strpos($output, '--format=') !== false);
 }