? drush-debug-messages.diff
? includes/table.inc
Index: drush.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/drush.php,v
retrieving revision 1.88
diff -u -r1.88 drush.php
--- drush.php	3 Oct 2010 05:30:16 -0000	1.88
+++ drush.php	4 Nov 2010 21:47:08 -0000
@@ -68,6 +68,10 @@
   $phases = _drush_bootstrap_phases(FALSE, TRUE);
   drush_set_context('DRUSH_BOOTSTRAP_PHASE', DRUSH_BOOTSTRAP_NONE);
 
+  // We need some global options processed at this early stage. Namely --debug.
+  drush_parse_args();
+  _drush_bootstrap_global_options();
+
   $return = '';
   $command_found = FALSE;
 
@@ -119,9 +123,10 @@
     elseif (!empty($args)) {
       drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt("The drush command '!args' could not be found.", array('!args' => $args)));
     }
-    else {
-      // This can occur if we get an error during _drush_bootstrap_drush_validate();
-      drush_set_error('DRUSH_COULD_NOT_EXECUTE', dt("Drush could not execute."));
+    // Set errors that ocurred in the bootstrap phases.
+    $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
+    foreach ($errors as $code => $message) {
+      drush_set_error($code, $message);
     }
   }
 
Index: includes/context.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/context.inc,v
retrieving revision 1.33
diff -u -r1.33 context.inc
--- includes/context.inc	5 Aug 2010 22:08:55 -0000	1.33
+++ includes/context.inc	4 Nov 2010 21:47:09 -0000
@@ -307,7 +307,7 @@
  *
  * This function will set the 'arguments' context of the current running script.
  *
- * When initially called by drush_parse_options, the entire list of arguments will
+ * When initially called by drush_parse_args, the entire list of arguments will
  * be populated, once the command is dispatched, this will be set to only the remaining
  * arguments to the command.
  *
@@ -321,7 +321,7 @@
 /**
  * Get the arguments passed to the drush.php script.
  *
- * When drush_set_arguments is initially called by drush_parse_options,
+ * When drush_set_arguments is initially called by drush_parse_args,
  * the entire list of arguments will be populated.
  * Once the command has been dispatched, this will be return only the remaining
  * arguments to the command.
Index: includes/environment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/environment.inc,v
retrieving revision 1.95
diff -u -r1.95 environment.inc
--- includes/environment.inc	4 Nov 2010 17:07:09 -0000	1.95
+++ includes/environment.inc	4 Nov 2010 21:47:09 -0000
@@ -497,9 +497,6 @@
   }
   drush_set_context('DRUSH_COLUMNS', $columns);
 
-  // parse the command line arguments.
-  drush_parse_args();
-
   // statically define a way to call drush again
   define('DRUSH_COMMAND', drush_find_drush());
 
@@ -555,8 +552,6 @@
   if ($backend || $quiet) {
     ob_start();
   }
-
-  _drush_bootstrap_global_options();
 }
 
 function _drush_bootstrap_global_options() {
