? includes/table.inc
Index: example.drushrc.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/example.drushrc.php,v
retrieving revision 1.21
diff -u -p -r1.21 example.drushrc.php
--- example.drushrc.php	30 Dec 2009 21:26:44 -0000	1.21
+++ example.drushrc.php	31 Dec 2009 18:44:58 -0000
@@ -73,6 +73,14 @@ $options['structure-tables'] = array(
 // Use POSIX path separator (':')
 # $options['script-path'] = 'sites/all/scripts:profiles/myprofile/scripts';
 
+/*
+ * Command-specific options
+ *
+ * To define options that are only applicable to certain commands,
+ * make an entry in the 'command-options' structures as shown below.
+ */
+# $options['command-options']['rsync'] = array('show-progress' => TRUE);
+
 /**
  * Variable overrides:
  *
Index: includes/command.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/command.inc,v
retrieving revision 1.48
diff -u -p -r1.48 command.inc
--- includes/command.inc	6 Dec 2009 12:53:38 -0000	1.48
+++ includes/command.inc	31 Dec 2009 18:44:58 -0000
@@ -214,6 +214,7 @@ function drush_parse_command() {
  */
 function drush_invoke($command) {
   drush_command_include($command);
+  drush_command_default_options($command);
   $args = func_get_args();
   array_shift($args);
 
@@ -474,6 +475,25 @@ function drush_command_include($command)
 }
 
 /**
+ * Conditionally include default options based on the command used.
+ */
+function drush_command_default_options($command) {
+  $options_were_set = FALSE;
+  $command_default_options = drush_get_option('command-options', array());
+  if (array_key_exists($command, $command_default_options)) {
+    foreach ($command_default_options[$command] as $key => $value) {
+      drush_set_option($key, $value, 'default');
+      $options_were_set = TRUE;
+    }
+  }
+  // If we set any options, go back and re-bootstrap any global
+  // options such as -y and -v.
+  if ($options_were_set) {
+    _drush_bootstrap_global_options();
+  }
+}
+
+/**
  * Determine whether a command file implements a hook.
  *
  * @param $module
Index: includes/context.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/context.inc,v
retrieving revision 1.17
diff -u -p -r1.17 context.inc
--- includes/context.inc	28 Dec 2009 22:45:49 -0000	1.17
+++ includes/context.inc	31 Dec 2009 18:44:58 -0000
@@ -125,22 +125,27 @@ function drush_load_config($context) {
     $options['context-path'][$context] = $config;
     require_once($config);
     
-    // If site aliases are defined in multiple drush configuration files,
-    // the normal mechanism would cause the highest priority 'site-aliases'
-    // array to mask all of the other aliases defined in different contexts.
-    // To allow all of the aliases defined in every context to be used together,
-    // we merge them all into the 'drush' context as they are encountered.
-    if ((isset($options)) && (array_key_exists('site-aliases', $options))) {
-      $cache =& drush_get_context('alias');
-      if (array_key_exists('site-aliases', $cache)) {
-        $cache['site-aliases'] = array_merge($cache['site-aliases'], $options['site-aliases']);
+    // There are certain options such as 'site-aliases' and 'command-options'
+    // that must be merged together if defined in multiple drush configuration
+    // files.  If we did not do this merge, then the last configuration file
+    // that defined any of these properties would overwrite all of the options
+    // that came before in previously-loaded configuration files.  We place
+    // all of them into the 'default' context so that this does not happen.
+    if (isset($options)) {
+      foreach (array('site-aliases', 'command-options') as $option_name) {
+        if ((isset($options)) && (array_key_exists($option_name, $options))) {
+          $cache =& drush_get_context('default');
+          if (array_key_exists($option_name, $cache)) {
+            $cache[$option_name] = array_merge($cache[$option_name], $options[$option_name]);
+          }
+          else {
+            $cache[$option_name] = $options[$option_name];
+          }
+          unset($options[$option_name]);
+        }
       }
-      else {
-        $cache['site-aliases'] = $options['site-aliases'];
-      }
-      unset($options['site-aliases']);
     }
-
+    
     drush_set_context($context, $options);
 
     // Instruct core not to queries since we are not outputting them.
Index: includes/environment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/environment.inc,v
retrieving revision 1.62
diff -u -p -r1.62 environment.inc
--- includes/environment.inc	31 Dec 2009 14:04:23 -0000	1.62
+++ includes/environment.inc	31 Dec 2009 18:44:58 -0000
@@ -435,7 +435,14 @@ function _drush_bootstrap_drush() {
   if ($backend || $quiet) {
     ob_start();
   }
+  
+  _drush_bootstrap_global_options();
 
+  // Find any command files that are available during this bootstrap phase.
+  _drush_find_commandfiles(DRUSH_BOOTSTRAP_DRUSH);
+}
+
+function _drush_bootstrap_global_options() {
   // Debug implies verbose
   drush_set_context('DRUSH_VERBOSE',     drush_get_option(array('v', 'verbose', 'd', 'debug'), FALSE));
   drush_set_context('DRUSH_DEBUG', drush_get_option(array('d', 'debug')));
@@ -455,9 +462,6 @@ function _drush_bootstrap_drush() {
     $nocolor = !($colors === FALSE || (is_numeric($colors) && $colors >= 3));
   }
   drush_set_context('DRUSH_NOCOLOR', $nocolor);
-
-  // Find any command files that are available during this bootstrap phase.
-  _drush_find_commandfiles(DRUSH_BOOTSTRAP_DRUSH);
 }
 
 /**
