Example #1
0
 public function show()
 {
     parent::show();
     $option = 0;
     $this->drawButtons($option);
     $this->terminal->readInput(function ($char, $isControl) use(&$option) {
         if ($char == '[C') {
             $option = min($option + 1, count($this->options) - 1);
             $this->drawButtons($option);
         } else {
             if ($char == '[D') {
                 $option = max(0, $option - 1);
                 $this->drawButtons($option);
             } else {
                 if ($char == "\n") {
                     return true;
                 }
             }
         }
     });
     $this->terminal->resetFormatting();
     return $this->options[$option][0];
 }