Esempio n. 1
0
/**
 * Output items in a table, JSON, CSV, IDs, or the total count
 *
 * @param [string] $format Format to use: 'table', 'json', 'csv', 'ids', 'count'
 * @param [array]  $items  Data to output
 * @param [array]  $fields Named fields for each datum,
 *                           array or comma-separated string
 * @return [void]
 */
function format_items($format, $items, $fields)
{
    $assoc_args = array('format' => $format, 'fields' => $fields);
    $formatter = new \Terminus\Formatter($assoc_args);
    $formatter->display_items($items);
}
Esempio n. 2
0
/**
 * Output items in a table, JSON, CSV, ids, or the total count
 *
 * @param string        $format     Format to use: 'table', 'json', 'csv', 'ids', 'count'
 * @param array         $items      Data to output
 * @param array|string  $fields     Named fields for each item of data. Can be array or comma-separated list
 */
function format_items($format, $items, $fields)
{
    $assoc_args = compact('format', 'fields');
    $formatter = new \Terminus\Formatter($assoc_args);
    $formatter->display_items($items);
}