? improve_strongarm_export.patch
Index: strongarm.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/strongarm/strongarm.drush.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 strongarm.drush.inc
--- strongarm.drush.inc	26 Jun 2009 21:58:38 -0000	1.1.2.1
+++ strongarm.drush.inc	9 Sep 2009 23:30:51 -0000
@@ -31,23 +31,92 @@ function strongarm_drush_command() {
 function strongarm_drush_export() {
   $vars = func_get_args();
   if (empty($vars)) {
+    $hidden_variables = array(
+      'css_js_query_string',
+      'date_default_timezone',
+      'drupal_http_request_fails',
+      'drupal_private_key',
+      'file_directory_temp',
+      'form_build_id_.+',
+      'install_profile',
+      'install_task',
+      'install_time',
+      'javascript_parsed',
+      'menu_masks',
+      'update_last_check',
+      'clean_url',
+    );
+    $preg = '/(' . implode('|', $hidden_variables) . ')/';
     $result = db_query('SELECT name FROM variable');
     $rows = array(array('Variables'));
     while ($row = db_fetch_array($result)) {
-      $rows[] = array_values($row);
+      if (!preg_match($preg, $row['name'])) {
+        $rows[] = array_values($row);
+      }
     }
     drush_print_table($rows, TRUE);
   }
   else {
+    $output = '/**
+ * Implementation of hook_strongarm().
+ */
+function {modulename}_strongarm() {
+  $conf = array();
+
+';
     $exports = array();
     foreach ($vars as $v) {
       // We use the very unlikely 'DRUSH_STRONGARM_NO_VALUE_HERE' as the 
       // default value which *should* be ok, right?
       $variable = variable_get($v, 'DRUSH_STRONGARM_NO_VALUE_HERE');
       if ($variable !== 'DRUSH_STRONGARM_NO_VALUE_HERE') {
-        $exports[$v] = $variable;
+        $output .= '  $conf[\'' . $v . '\'] = ' . strongarm_drush_var_export($variable, '  ') . ";\n";
       }
     }
-    drush_print(var_export($exports));
+    $output .= '
+  return $conf;
+}';
+    drush_print($output);
   }
 }
+
+/**
+ * Export var function -- from Views.
+ */
+function strongarm_drush_var_export($var, $prefix = '', $init = TRUE) {
+  if (is_array($var)) {
+    if (empty($var)) {
+      $output = 'array()';
+    }
+    else {
+      $output = "array(\n";
+      foreach ($var as $key => $value) {
+        $output .= "  '$key' => " . strongarm_drush_var_export($value, '  ', FALSE) . ",\n";
+      }
+      $output .= ')';
+    }
+  }
+  else if (is_bool($var)) {
+    $output = $var ? 'TRUE' : 'FALSE';
+  }
+  else if (is_string($var) && strpos($var, "\n") !== FALSE) {
+    // Replace line breaks in strings with a token for replacement
+    // at the very end. This protects whitespace in strings from
+    // unintentional indentation.
+    $var = str_replace("\n", "***BREAK***", $var);
+    $output = var_export($var, TRUE);
+  }
+  else {
+    $output = var_export($var, TRUE);
+  }
+
+  if ($prefix) {
+    $output = str_replace("\n", "\n$prefix", $output);
+  }
+
+  if ($init) {
+    $output = str_replace("***BREAK***", "\n", $output);
+  }
+
+  return $output;
+}
\ No newline at end of file
