? drush_views-list-displays.patch
Index: drush_views.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush_views/drush_views.drush.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 drush_views.drush.inc
--- drush_views.drush.inc	14 Mar 2010 09:45:59 -0000	1.2.2.1
+++ drush_views.drush.inc	8 Apr 2010 13:33:45 -0000
@@ -38,6 +38,13 @@ function drush_views_drush_help($section
      case 'drush:views-delete':
        return dt("Usage: drush [options] views-delete <views>\n\n"
                  ."Delete the specified views. Use 'ALL' to delete all normal/overridden views.");
+    case 'drush:views-displays':
+      return dt("Usage: drush [options] views-displays <view>\n\n"
+               ."List all displays associated with given view.");
+    case 'drush:views-templates':
+      return dt("Usage: drush [options] views-templates <display> [output - optional]\n\n"
+               ."List the templates in a list, mark the one that is currently active for a given display."
+               ."If you specify the output templates for that display only will be shown.");
      /*
      case 'drush:views-tag':
        return dt("Usage: drush [options] views-tag [--names] \n"
@@ -76,6 +83,18 @@ function drush_views_drush_command() {
     'drupal dependencies' => array('views'),
     'aliases' => array('vwrm'),
   );
+  $items['views-displays'] = array(
+    'callback' => 'drush_views_displays',
+    'description' => 'List the displays implemented by the view.',
+    'drupal dependencies' => array('views'),
+    'aliases' => array('vwd'),
+  );
+  $items['views-templates'] = array(
+    'callback' => 'drush_views_templates',
+    'description' => 'List the templates used by the display.',
+    'drupal dependencies' => array('views'),
+    'aliases' => array('vwt'),
+  );
   /*
   $items['views tag'] = array(
     'callback' => 'drush_views_tag',
@@ -287,6 +306,49 @@ function drush_views_delete() {
 }
 
 /**
+ * Command callback: views-displays.
+ */
+function drush_views_displays($view_id) {
+  $view = views_get_view($view_id);
+  if (empty($view)) {
+    drush_log(dt("No view found. Try drush views list for available views."), 'error');
+  }
+  else {
+    drush_log(dt("View displays:"), 'ok');
+    foreach ($view->display as $display_id => $display) {
+      drush_log(dt("@display_id: @display_name, type: @display_type",
+      array(
+        '@display_id' => $display_id,
+        '@display_name' => $display->display_title,
+        '@display_type' => $display->display_plugin,
+      )), 'ok');
+    }
+  }
+}
+
+/**
+ * Command callback: views-templates.
+ */
+function drush_views_templates($view_id, $display) {
+  $view = views_get_view($view_id);
+  if (empty($view)) {
+    drush_log(dt("No view found. Try drush views list for available views."), 'error');
+  }
+  elseif (!isset($view->display[$display])) {
+    drush_log(dt("There is no such display in this view. Try drush views displays @view_id to get a list
+    of available displays.", array('@view_id' => $view_id)), 'error');
+  }
+  else {
+    drush_log(dt("Theme functions in trigger order:"), 'ok');
+    $theme = variable_get('theme_default', 'garland');
+    $themes = views_theme_functions($theme, $view, $view->display[$display]);
+    foreach ($themes as $theme_function) {
+      drush_log(dt("  @theme_function", array('@theme_function' => $theme_function)), 'ok'); 
+    }
+  }
+}
+
+/**
  * Command callbacks: views tag, views tag list and views tag export.
  */
 function drush_views_tag() {
