Wildcards in strongarm's drush exports, similar to the begins-with/contains/ends-with feature of variable_dump. This way you can run

drush strongarm %notification%

Index: strongarm.drush.inc
===================================================================
--- strongarm.drush.inc	(revision 949)
+++ strongarm.drush.inc	(working copy)
@@ -53,7 +53,17 @@
   }
   else {
     $exports = array();
-    foreach ($vars as $v) {
+    $v_names = array();
+    foreach($vars as $v){
+	  if(strpos($v,'%')!==false){
+		$result=db_query('SELECT name FROM variable WHERE name LIKE "%s"', $v);
+		while($v_name = db_fetch_object($result))
+		  $v_names[] = $v_name->name;
+	  }else{
+		$v_names[] = $v;
+	  }	
+    }
+    foreach ($v_names 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');
CommentFileSizeAuthor
#1 588414-1_wildcards.patch2.01 KBalex_b

Comments

alex_b’s picture

Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new2.01 KB

Similar approach. I've broken out the export function for legibility.

q0rban’s picture

Title: wildcarts in 'drush strongarm' » wildcards in 'drush strongarm'

Subscribe

q0rban’s picture

You might want to look at the code in the vget drush command, as it already does something similar.

jmiccolis’s picture

Status: Needs review » Closed (won't fix)

q0rban, very nice point.

I've just removed the strongarm drush command from the DRUPAL-6--2 branch. At this point we're moving to ctools to manage the exports so we're actually no longer dependent on this command at all.

lefnire’s picture

stinks drush vget only works as x%, not %x or %x% (aka, you can only search for variables beginning with something). Anyway, issue for another queue. Thanks guys!