Commit 3c4e6f9c authored by tstoeckler's avatar tstoeckler

Issue #1268342 by tstoeckler: Clean up drush libraries-list command.

parent c60cfc3e
Libraries 7.x-2.x, xxxx-xx-xx
-----------------------------
#1268342 by tstoeckler: Clean up drush libraries-list command.
#962214 by tstoeckler, sun: Add support for library dependencies.
#1224838 by sun, mjpa: Fix library path not being prepended to JS/CSS files.
#1023258 by tstoeckler: Make 'files' consistently keyed by filename.
......
......@@ -54,36 +54,31 @@ function libraries_drush_list() {
}
else {
$header = array('Name', 'Status', 'Version', 'Variants');
$rows = array();
// drush_print_table() automatically treats the first row as the header, if
// $header is TRUE.
$rows[] = array(dt('Name'), dt('Status'), dt('Version'), dt('Variants'), dt('Dependencies'));
foreach ($libraries as $name => $library) {
// Status and version
if ($library['installed']) {
$status = 'OK';
$version = $library['version'];
}
else {
$status = drupal_ucfirst($library['error']);
$version = (empty($library['version']) ? '-' : $library['version']);
}
// Variants
$status = ($library['installed'] ? dt('OK') : drupal_ucfirst($library['error']));
$version = (($library['installed'] && !empty($library['version'])) ? $library['version'] : '-');
// Only list installed variants.
$variants = array();
foreach ($library['variants'] as $variant_name => $variant) {
if ($variant['installed']) {
$variants[] = $variant_name;
}
}
if (empty($variants)) {
$variants = '-';
}
else {
$variants = implode(', ', $variants);
}
$variants = (empty($variants) ? '-' : implode(', ', $variants));
$dependencies = (!empty($library['dependencies']) ? implode(', ', $library['dependencies']) : '-');
$rows[] = array($name, $status, $version, $variants);
$rows[] = array($name, $status, $version, $variants, $dependencies);
}
$table = new Console_Table();
drush_print($table->fromArray($header, $rows));
// Make the possible values for the 'Status' column and the 'Version' header
// wrap nicely.
$widths = array(0, 12, 7, 0, 0);
drush_print_table($rows, TRUE, $widths);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment