? .cvsignore
? 617428_do_not_disable_modules_when_searching_for_dependencies.patch
? 654682_package_grouping_in_statusmodules-2.patch
? 654682_package_grouping_in_statusmodules.patch
? drush_enable_hook_requirement_error.patch
? drushrc.php
? nbproject
? test.php
? includes/table.inc
Index: commands/pm/pm.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/pm/pm.drush.inc,v
retrieving revision 1.63
diff -w -u -p -r1.63 pm.drush.inc
--- commands/pm/pm.drush.inc	8 Dec 2009 18:31:55 -0000	1.63
+++ commands/pm/pm.drush.inc	15 Dec 2009 12:28:26 -0000
@@ -33,6 +33,14 @@ define('DRUSH_PM_NO_VERSION', 103);
  */
 define('DRUSH_PM_NOT_FOUND', 104);
 
+function _pm_sort_module_info_package($a, $b) {
+  $cmp = strcmp(strtolower($a->info['package']), strtolower($b->info['package']));
+  if ($cmp == 0) {
+    $cmp = strcmp(strtolower($a->info['name']), strtolower($b->info['name']));
+  }
+  return $cmp;
+}
+
 /**
  * Implementation of hook_drush_help().
  */
@@ -105,6 +113,7 @@ function pm_drush_command() {
     'callback arguments' => array(array(), FALSE),
     'options' => array(
       '--pipe' => 'Returns a space delimited list of enabled modules.',
+      '--package' => 'Show the package information for each module and sort the list by it.',
     ),
     'aliases' => array('sm'),
   );
@@ -345,7 +354,15 @@ function pm_module_manage($modules = arr
 }
 
 function pm_module_status($enabled, $module_info) {
-  $rows[] = array(dt('Name'), dt('Status'), dt('Description'));
+  $headers = array(dt('Name'), dt('Status'), dt('Description'));
+  $package = drush_get_option('package');
+  if ($package) {
+    $headers = array_merge(array(dt('Package')), $headers);
+  }
+  $rows[] = $headers;
+  if ($package) {
+    uasort($module_info, '_pm_sort_module_info_package');
+  }
   foreach ($module_info as $module_name => $module) {
     $enabled = dt('Disabled');
     if ($module->status) {
@@ -353,7 +370,11 @@ function pm_module_status($enabled, $mod
       $pipe[] = $module_name;
     }
     $info = $module_info[$module_name]->info;
-    $rows[] = array($info['name'] . ' (' . $module_name . ')', $enabled, truncate_utf8($info['description'], 60, FALSE, TRUE));
+    $row = array($info['name'] . ' (' . $module_name . ')', $enabled, truncate_utf8($info['description'], 60, FALSE, TRUE));
+    if ($package) {
+      $row = array_merge(array($info['package']), $row);
+    }
+    $rows[] = $row;
   }
   drush_print_table($rows, TRUE);
 
