See the code

$ drush mb 

Enter the module name: foo
Enter the human readable name: bar
Enter the description: baz
Enter the dependencies: views
Enter available hooks: views_api
Proposed foo.module:
<?php
// $Id$
/**
 * @file foo.module
 * TODO: Enter file description here.
 */

/**
 * Implementation of hook_views_api().
 */
function foo_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'foo'),
  );
}

Comments

joachim’s picture

Status: Needs review » Needs work

This is great! Thanks :D

But sometimes (actually, most times), I don't want to bother entering the human name, help text, etc etc. Can we have it so entering blank skips those? At the moment it insists on entry.

I'm going to commit the part of this patch that's at #781294: change drush commands to match drush core now.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new3.1 KB

This sadly needs a drush patch #838684: allow drush_prompt to be optional

If the drush patch is not commited just the optional feature does not work

joachim’s picture

Looks good.

I kinda think maybe this handling of missing options by prompting should be moved up to Drush core. But that might take a while...

I'll have a ponder about a killswitch / onswitch for the interactive mode. Either --i to get the prompts or --noi to not, or something like that.

dawehner’s picture

--interactive -i

I think it's worth to be the default.

so --non-interactive -noi would be fine

joachim’s picture

StatusFileSize
new4.65 KB
+++ drush/module_builder.drush.inc	27 Jun 2010 11:05:52 -0000
@@ -228,20 +230,62 @@ function module_builder_callback_build()
+      else {
+        unset($module_data[$name]);
+      }

Not sure why we need this. The old code was happy to use get_option regardless, and we don't get to that line with anything set from the prompt. I reckon we can remove it.

Here's a reroll against some changes I've made on CVS. I've moved the hook prompt to be further up, so the crucial things are asked for first (and you can just bounce the return key for the rest). To do that I've had to get it into the generalized data array, which is a bit more convoluted...

Also implemented --non-interactive --noi though note it has to be --noi with two hyphens -- I assume single hyphen only works for a single letter option.

Can you take a look?

joachim’s picture

StatusFileSize
new5.48 KB

Updated patch with help text.

joachim’s picture

Bump...

@dereine: any chance you could review this? :)

dawehner’s picture

StatusFileSize
new5.46 KB
+++ drush/module_builder.drush.inc	27 Jun 2010 11:05:52 -0000
@@ -228,20 +230,62 @@ function module_builder_callback_build()
+      else {
+        unset($module_data[$name]);
+      }

Right we can remove it. Here is a updated patch.

The rest looks fine.

Manual testing worked fine again.

joachim’s picture

Status: Needs review » Fixed
StatusFileSize
new5.32 KB

Ace :)

I've made another slight change so it's 'required' => TRUE rather than 'optional' => FALSE as that's consistent with FormAPI.

Committed the attached patch to both 6--2 and 7--2 branches (with reroll on the 7).

Thanks for all your work on this! It's made module builder a whole lot cooler!!! :D

#838660 by dereine, joachim: Added drush wizard.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.