? .kdev4
? drush-commands.patch
? drush-wizard.patch
? module_builder-DRUPAL-6--2.kdev4
Index: drush/module_builder.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/module_builder/drush/Attic/module_builder.drush.inc,v
retrieving revision 1.1.2.58
diff -u -p -r1.1.2.58 module_builder.drush.inc
--- drush/module_builder.drush.inc	19 Jan 2010 13:21:16 -0000	1.1.2.58
+++ drush/module_builder.drush.inc	27 Jun 2010 09:18:52 -0000
@@ -20,7 +20,7 @@ define('MODULE_BUILDER_ENV', 'drush');
  * Implementation of hook_drush_command().
  *
  * In this hook, you specify which commands your
- * drush module makes available, what it does and 
+ * drush module makes availible, what it does and 
  * description.
  *
  * Notice how this structure closely resembles how 
@@ -35,13 +35,14 @@ function module_builder_drush_command() 
   $items = array();
 
   // the key in the $items array is the name of the command.
-  $items['mb'] = array(
+  $items['mb-build'] = array(
     'callback' => 'module_builder_callback_build',
     'description' => "Generate the code for a new Drupal module, including file headers and hook implementations.",
     'arguments' => array(
       'module name' => 'The machine name of the module.',
       'hooks' => 'Short names of hooks, separated by spaces.',
-    ),    
+    ),
+    'aliases' => array('mb'),
     'options' => array(
       '--data' => "Location to read hook data. May be absolute, or relative to Drupal files dir. Defaults to 'files/hooks'.",
       '--build' => "Which file type to generate: 'all', 'code', 'info', 'FILE'. " .
@@ -81,31 +82,32 @@ function module_builder_drush_command() 
     ),
   );
   
-  $items['mbdl'] = array(
+  $items['mb-download'] = array(
     'callback' => 'module_builder_callback_hook_download',
     'description' => "Update module_builder hook data.",
     'options' => array(
       '--data' => "Location to save downloaded files. May be absolute, or relative to Drupal files dir. Defaults to 'files/hooks'.",
     ),
+    'aliases' => array('mbdl'),
     //'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap at all.    
   );
   
-  $items['hooks'] = array(
+  $items['mb-list'] = array(
     'callback' => 'module_builder_callback_hook_list',
     'description' => "List the hooks module_builder knows about.",
   );
 
-  $items['dochooks'] = array(
+  $items['mb-dochooks'] = array(
     'callback' => 'module_builder_callback_doc_hooks',
     'description' => "Adds comment headers to hooks that need them in the given module.",
   );
 
-  $items['docparams'] = array(
+  $items['mb-docparams'] = array(
     'callback' => 'module_builder_callback_doc_params',
     'description' => "Adds params... WIP!",
   );
   
-  $items['mbdebug'] = array(
+  $items['mb-debug'] = array(
     'callback' => 'module_builder_callback_debug',
     'description' => "Debug module builder. Does whatever was needed at the time.",
     //'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap at all.
@@ -128,7 +130,7 @@ function module_builder_drush_command() 
  */
 function module_builder_drush_help($section) {
   switch ($section) {
-    case 'drush:mb':
+    case 'drush:mb-build':
       return dt("Generates module code with the specified hooks.");
   }
 }
@@ -228,20 +230,57 @@ function module_builder_callback_build()
  * Helper function to build the array of module_data.
  */
 function module_builder_build_data($commands) {
-  // The first argument is the module machine name.
-  $module_data['module_root_name'] = array_shift($commands);  
-  
   // Heap of defaults. Later find some nice way of asking for these. 
   //$data['module_readable_name'] = ucfirst($data['module_root_name']);
   //$data['module_short_description'] = 'Description';
   // todo: some function in common.inc to set defaults?
-  
-  $module_data['module_readable_name']     = drush_get_option('name');
-  $module_data['module_short_description'] = drush_get_option('desc');
-  $module_data['module_help_text']         = drush_get_option('help');
-  $module_data['module_dependencies']      = drush_get_option('dep');
-  $module_data['module_package']           = drush_get_option('package');
-  
+
+  $data = array(
+    'module_root_name' => array(
+      'prompt' => dt('module name'),
+    ),
+    'module_readable_name' => array(
+      'key' => 'name',
+      'prompt' => dt('human readable name'),
+    ),
+    'module_short_description' => array(
+      'key' => 'desc',
+      'prompt' => dt('description'),
+    ),
+    'module_help_text' => array(
+      'key' => 'help',
+      'prompt' => dt('help text'),
+    ),
+    'module_dependencies' => array(
+      'key' => 'dep',
+      'prompt' => dt('dependencies'),
+    ),
+    'module_package' => array(
+      'key' => 'package',
+      'prompt' => dt('package'),
+    ),
+  );
+
+  foreach ($data as $name => $definition) {
+    if (isset($definition['key'])) {
+      $module_data[$name] = drush_get_option($definition['key']);
+    }
+    else {
+      // The first argument is the module machine name.
+      $module_data[$name] = array_shift($commands);
+    }
+
+    if (empty($module_data[$name])) {
+      $value = drush_prompt(dt('Enter the @type', array('@type' => $definition['prompt'])));
+      if ($value !== FALSE) {
+        $module_data[$name] = $value;
+      }
+      else {
+        unset($module_data[$name]);
+      }
+    }
+  }
+
   return $module_data;
 }
 
@@ -260,7 +299,10 @@ function module_builder_build_data($comm
 function module_builder_callback_module($commands, &$module_data, $build_list) {
   // The first argument is the module machine name.
   array_shift($commands);  
-    
+
+  if (empty($commands)) {
+    $commands = explode(" ", drush_prompt(dt('Enter available hooks')));
+  }
   foreach ($commands as $hook_name) {
     $module_data['hooks']["hook_$hook_name"] = TRUE;    
   }
