Index: helpinject.drush.inc
===================================================================
RCS file: helpinject.drush.inc
diff -N helpinject.drush.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ helpinject.drush.inc	8 Oct 2010 15:52:56 -0000
@@ -0,0 +1,67 @@
+<?php
+// $Id: $
+
+/**
+ * Implementation of hook_drush_help().
+ */
+function helpinject_drush_help($section) {
+  switch ($section) {
+    case 'drush:helpinject':
+      return dt('Generate Advanced Help files and contextual icons based on data in books.');
+  }
+}
+
+/**
+ * Implementation of hook_drush_command().
+ */
+function helpinject_drush_command() {
+  $items = array();
+  $items['helpinject'] = array(
+    'description' => "Generate Advanced Help files and contextual icons based on data in books.",
+    'examples' => array(
+      'drush helpinject --package_name="Package of Examples" "Example module" example 21' => 'Generate a new help module from the book with nid 21.',
+      'drush helpinject --package_name="Package of Examples" --languages=fr,es "Example module" example 21' => 'Generate a new help module from the book with nid 21, exporting French and Spanish Translations.',
+    ),
+    'arguments' => array(
+      'moudle_name' => 'The human readable name of the module that will be generated.',
+      'module' => 'The base name of the module that will be generated. Use only lowercase letters and the underscore (_).',
+      'book_ids' => 'A space delimited list of one or more book IDs to be used for help.'
+    ),
+    'options' => array(
+      '--package_name' => "The package name that groups modules on the admin/build/modules page.",
+      '--languages' => "Comma delimited list of languages to be exported.",
+    ),
+    'drupal dependencies' => array('helpinject'),
+    'aliases' => array('hi'),
+  );
+  return $items;
+}
+
+/**
+ * Drush function
+ */
+function drush_helpinject(){
+  $args = func_get_args();
+  $package_name = drush_get_option('package_name');
+  $module_readable_name = array_shift($args);
+  $module_base_name = array_shift($args);
+  $languages = drush_get_option('languages');
+  if(strlen($languages)){
+    $languages = drupal_map_assoc(explode(',', $languages));
+  } else {
+    $languages = array('en' => 'en'); // Is this correct, or should it just be left blank?
+  }
+  if(count($args)){
+    $form_state = array(
+      'values' => array(
+        'module_readable_name' => $module_readable_name,
+        'module_base_name' => $module_base_name,
+        'package_name' => $package_name,
+        'languages' => $languages,
+        'book_id' => drupal_map_assoc($args)
+      )
+    );
+    $form = array();
+    helpinject_export_form_submit($form, $form_state);
+  }
+}
\ No newline at end of file
