Example #1
0
 /**
  * Show a list of available options
  */
 protected function showOptions()
 {
     $this->writeln("Options:", Colors::YELLOW);
     $rows = array(array(Colors::colorize('--version', Colors::GREEN), "Show version number"), array(Colors::colorize('--working-dir=DIR', Colors::GREEN), "If specified, use the given directory as working directory"), array(Colors::colorize('--config=FILE', Colors::GREEN), "Use an alternative config file"));
     $formater = new TextFormater(array('indent' => 2));
     $table = new Table(null, $rows, array('border' => false, 'frame' => false));
     $this->writeln($formater->format($table->render()));
 }
 /**
  * Show available options and commands
  */
 protected function showCommands()
 {
     $formater = new TextFormater(array('indent' => 2));
     $this->writeln('Available commands:', Colors::YELLOW);
     $rows = [];
     foreach ($this->console->getCommands() as $name => $fqdn) {
         $help = Help::fromFQDN($fqdn);
         $rows[] = array(Colors::colorize($name, Colors::GREEN), $help->getShortDescription());
     }
     $table = new Widgets\Table(null, $rows, array('border' => false, 'frame' => false));
     $this->writeln($formater->format($table->render()));
 }
Example #3
0
 /**
  * Show a lists with all updates and their status
  */
 public function showComplete()
 {
     $updates = $this->dbvc()->getUpdatesAvailable();
     if (empty($updates)) {
         if ($this->verbosity) {
             $this->writeln("No updates available");
         }
         return;
     }
     $done = $this->dbvc()->getUpdatesDone();
     $prefix = "";
     if ($this->verbosity) {
         $this->writeln("Available updates:", Colors::YELLOW);
     }
     if ($this->short) {
         $prefix = $this->verbosity ? "  " : '';
         foreach ($updates as $update) {
             $status = !in_array($update, $done) ? 'o' : 'x';
             $this->writeln($prefix . $status . ' ' . $update);
         }
     } else {
         $rows = array();
         foreach ($updates as $update) {
             $status = !in_array($update, $done) ? Colors::colorize('open', Colors::YELLOW) : Colors::colorize('done', Colors::GREEN);
             $rows[] = array($update, $status);
         }
         $formater = new \ConsoleKit\TextFormater(array('indent' => $this->verbosity ? 2 : 0));
         $table = new Table(null, $rows, array('border' => false, 'frame' => false));
         $this->writeln($formater->format($table->render()));
     }
 }
Example #4
0
 /**
  * Render subcommands
  * 
  * @return string
  */
 protected function renderSubcommands()
 {
     if (empty($this->subCommands)) {
         return null;
     }
     $rows = array();
     foreach ($this->subCommands as $name => $desc) {
         $rows[] = array(Colors::colorize($name, Colors::GREEN), $desc);
     }
     $table = new Widgets\Table(null, $rows, array('border' => false, 'frame' => false));
     $formater = new TextFormater(array('indent' => 2));
     return Colors::colorize("Sub commands:\n", Colors::YELLOW) . $formater->format($table->render()) . "\n";
 }