function drush_print_table

8.0.x output.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)
6.x output.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)
7.x output.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)
3.x drush.inc drush_print_table($rows, $header = FALSE, $widths = array())
4.x drush.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)
5.x output.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)
master output.inc drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL)

Print a formatted table.

Parameters

$rows: The rows to print.

$header: If TRUE, the first line will be treated as table header.

$widths: An associative array whose keys are column IDs and values are widths of each column (in characters). If not specified this will be determined automatically, based on a "best fit" algorithm.

$handle: File handle to write to. NULL will write to standard output, STDERR will write to the standard error. See http://php.net/manual/en/features.commandline.io-streams.php

Return value

$tbl Use $tbl->getTable() to get the output from the return value.

Related topics

9 calls to drush_print_table()
drush_choice in includes/drush.inc
Ask the user to select an item from a list. From a provided associative array, drush_choice will display all of the questions, numbered from 1 to N, and return the item the user selected. "0" is always cancel; entering a blank line is also…
drush_core_watchdog_show_many in commands/core/watchdog.drush.inc
Print a table of watchdog messages.
drush_docs_errorcodes in commands/core/docs.drush.inc
docs-errorcodes command. Print a list of all error codes that can be found.
drush_help_listing_print in commands/core/help.drush.inc
Print CLI table or HTML table listing all commands.
drush_print_help in commands/core/help.drush.inc
Print the help for a single command to the screen.

... See full list

File

includes/output.inc, line 245

Code

function drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL) {
  $tbl = _drush_format_table($rows, $header, $widths);
  $output = $tbl->getTable();
  if (!stristr(PHP_OS, 'WIN')) {
    $output = str_replace("\r\n", PHP_EOL, $output);
  }

  drush_print(rtrim($output), 0, $handle);
  return $tbl;
}