From 4ae60a8114eb6671e7a09603280aba6fc31f0cc8 Mon Sep 17 00:00:00 2001
From: Charlie O'Leary <charlie@livebusiness.com.au>
Date: Tue, 24 Apr 2012 12:43:56 +1000
Subject: [PATCH] Issue #1544134: allow drush command to specify parent theme

---
 includes/mobile_jquery.drush.inc |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/includes/mobile_jquery.drush.inc b/includes/mobile_jquery.drush.inc
index 8e5c0e4..915595c 100644
--- a/includes/mobile_jquery.drush.inc
+++ b/includes/mobile_jquery.drush.inc
@@ -18,6 +18,7 @@ function mobile_jquery_drush_command() {
     ),
     'options' => array(
       'site' => '[optional] A specified site directory to install you new theme in. (Defaults to site environment Mobile JQuery Theme is located)',
+      'parent' => '[optional] A parent theme for you sub-theme - defaults to mobile_jquery',
     ),
     'examples' => array(
       'drush mobile_jquery "My theme name"' => 'Create a sub-theme, using the default options.',
@@ -79,7 +80,16 @@ function drush_mobile_jquery($name = NULL, $machine_name = NULL) {
     // Rename the .info file.
     $subtheme_info_file = $subtheme_path . '/' . $machine_name . '.info';
     drush_op('rename', $subtheme_path . '/STARTER.txt', $subtheme_info_file);
-  
+
+    // Get our "parent" site option from the drush command
+    $parent = drush_get_option('parent', FALSE);
+
+    // if the command specifies a parent theme
+    if ($parent) {
+      // replace the default with our parent theme
+      drush_op('mobile_jquery_file_str_replace', $subtheme_info_file, "base theme = 'mobile_jquery'", "base theme = '$parent'");
+    }
+
     // Alter the contents of the .info file based on the command options.
     $alterations = array(
       " = 'STARTER'" => ' = ' . $name,
-- 
1.7.0.4

