Ejemplo n.º 1
0
 /**
  * Show items in a \cli\Table.
  *
  * @param array $items
  * @param array $fields
  */
 private static function show_table($items, $fields)
 {
     $table = new \cli\Table();
     $enabled = \cli\Colors::shouldColorize();
     if ($enabled) {
         \cli\Colors::disable(true);
     }
     $table->setHeaders($fields);
     foreach ($items as $item) {
         $table->addRow(array_values(\WP_CLI\Utils\pick_fields($item, $fields)));
     }
     foreach ($table->getDisplayLines() as $line) {
         \WP_CLI::line($line);
     }
     if ($enabled) {
         \cli\Colors::enable(true);
     }
 }