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');
Comments
Comment #1
alex_b commentedSimilar approach. I've broken out the export function for legibility.
Comment #2
q0rban commentedSubscribe
Comment #3
q0rban commentedYou might want to look at the code in the vget drush command, as it already does something similar.
Comment #4
jmiccolis commentedq0rban, 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.
Comment #5
lefnire commentedstinks 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!