Пример #1
0
 public function listen()
 {
     Cursor::setStyle('▋', true);
     do {
         Cursor::colorize('b fg(yellow) bg(blue)');
         echo '◼ datatext > ';
         Cursor::colorize('!b fg(default) bg(default)');
         $line = $this->readline->readLine(' ');
         if ($line === 'fake') {
             $rows = [];
             $size = Window::getSize();
             for ($i = 0; $i < $size['y'] - 4; $i++) {
                 $row = [];
                 for ($j = 0; $j < 10; $j++) {
                     $row[] = $this->faker->name;
                 }
                 $rows[] = $row;
             }
             $table = new Table($rows, ['headers' => ['a', 'b', 'c', 'd', 'e'], 'stickyColumns' => [2]]);
             $navigable = new NavigableTable($table);
             $navigable->render();
         } else {
             echo '< ', $line, "\n";
         }
     } while (false !== $line && 'quit' !== $line);
 }
Пример #2
0
 public function render()
 {
     $this->renderInternal();
     Cursor::setStyle('▋', true);
     do {
         $this->readline = new Readline();
         $this->readline->addMapping('j', xcallable($this, '_bindJ'));
         $this->readline->addMapping('k', xcallable($this, '_bindK'));
         $line = $this->readline->readLine(' ');
     } while (false !== $line && 'quit' !== $line);
 }