? views
? includes/table.inc
Index: commands/core/core.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/core.drush.inc,v
retrieving revision 1.135
diff -u -p -r1.135 core.drush.inc
--- commands/core/core.drush.inc	1 Dec 2010 20:59:56 -0000	1.135
+++ commands/core/core.drush.inc	4 Dec 2010 15:24:31 -0000
@@ -37,7 +37,7 @@ function core_drush_command() {
       'drush help pm-download' => 'Show help for one command.',
       'drush help dl' => 'Show help for one command using an alias.',
     ),
-    'topics' => array('core-readme'),
+    'topics' => array('docs-readme'),
   );
   $items['core-cron'] = array(
     'description' => 'Run all cron hooks.',
@@ -219,16 +219,6 @@ function core_drush_command() {
     'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
   );
 
-  // Topic commands
-  $items['core-readme'] = array(
-    'description' => dt('README.txt'),
-    'hidden' => TRUE,
-    'topic' => TRUE,
-    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
-    'callback' => 'drush_print_file',
-    'callback arguments' => array(DRUSH_BASE_PATH . '/README.txt'),
-  );
-
   return $items;
 }
 
Index: commands/core/docs.drush.inc
===================================================================
RCS file: commands/core/docs.drush.inc
diff -N commands/core/docs.drush.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ commands/core/docs.drush.inc	4 Dec 2010 15:24:31 -0000
@@ -0,0 +1,81 @@
+<?php
+// $Id: docs.drush.inc,v 1.4 2010/10/06 21:00:26 weitzman Exp $
+
+/**
+ * @file
+ *   Documentation commands providing various topics.
+ */
+
+/**
+ * Implementation of hook_drush_command().
+ *
+ * @return
+ *   An associative array describing your command(s).
+ */
+function docs_drush_command() {
+  //
+  // Topic commands.
+  // Any commandfile may add topics.
+  // Set 'topic' => TRUE to indicate the command is a topic (REQUIRED)
+  // Begin the topic name with the name of the commandfile (just like
+  // any other command).
+  //
+  $items['docs-readme'] = array(
+    'description' => dt('README.txt'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/README.txt'),
+  );
+  $items['docs-api'] = array(
+    'description' => dt('Drush API'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/drush.api.php'),
+  );
+  $items['docs-configuration'] = array(
+    'description' => dt('Drush configuration overview with examples'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/examples/example.drushrc.php'),
+  );
+  $items['docs-aliases'] = array(
+    'description' => dt('Site aliases overview with examples'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/examples/example.aliases.drushrc.php'),
+  );
+  $items['docs-examplescript'] = array(
+    'description' => dt('Example drush script'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/examples/helloworld.script'),
+  );
+  $items['docs-examplecommand'] = array(
+    'description' => dt('Example drush command'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/examples/sandwich.drush.inc'),
+  );
+  $items['docs-policy'] = array(
+    'description' => dt('Example policy file'),
+    'hidden' => TRUE,
+    'topic' => TRUE,
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
+    'callback' => 'drush_print_file',
+    'callback arguments' => array(DRUSH_BASE_PATH . '/examples/policy.drush.inc'),
+  );
+
+  return $items;
+}
Index: commands/core/topic.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/topic.drush.inc,v
retrieving revision 1.4
diff -u -p -r1.4 topic.drush.inc
--- commands/core/topic.drush.inc	6 Oct 2010 21:00:26 -0000	1.4
+++ commands/core/topic.drush.inc	4 Dec 2010 15:24:31 -0000
@@ -23,8 +23,11 @@ function topic_drush_command() {
       'drush topic core-context' => 'Show documentation for the drush context API',
       'drush core-context' => 'Show documentation for the drush context API',
     ),
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
     'aliases' => array('topic'),
+    'topics' => array('docs-readme'),
   );
+
   return $items;
 }
 
@@ -39,6 +42,7 @@ function topic_drush_help_alter($command
     $command['topic_section'][$topic_name] = dt($implemented[$topic_name]['description']);
   }
 }
+
 /**
  * A command callback.
  *
@@ -58,7 +62,13 @@ function drush_core_topic($topic_name = 
       return;
     }
   }
-  return drush_do_command_redispatch($topic_name);
+  // If the topic name is not found, check for
+  // "docs-$topic_name".  This allows users to be
+  // just a bit lazy when selecting core topics by name.
+  if (!isset($commands[$topic_name]) && isset($commands["docs-$topic_name"])) {
+    $topic_name = "docs-$topic_name";
+  }
+  return drush_redispatch($commands[$topic_name]);
 }
 
 /**
@@ -72,4 +82,4 @@ function drush_get_topics() {
     }
   }
   return $topics;
-}
\ No newline at end of file
+}
Index: includes/command.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/command.inc,v
retrieving revision 1.88
diff -u -p -r1.88 command.inc
--- includes/command.inc	10 Nov 2010 02:55:41 -0000	1.88
+++ includes/command.inc	4 Dec 2010 15:24:32 -0000
@@ -333,24 +333,31 @@ function drush_parse_command() {
 
   // We have found a command that matches. Set the appropriate values.
   if ($command) {
-    // Special case. Force help command if --help option was specified.
-    if (drush_get_option(array('h', 'help'))) {
-      $arguments = array($command['command']);
-      $command = $implemented['help'];
-      $command['arguments'] = $arguments;
-    }
-    else {
-      // Merge specified callback arguments, which precede the arguments passed on the command line.
-      if (isset($command['callback arguments']) && is_array($command['callback arguments'])) {
-        $arguments = array_merge($command['callback arguments'], $arguments);
-      }
-    }
-    $command['arguments'] = $arguments;
+    _drush_prepare_command($command, $arguments);
     drush_set_command($command);
   }
   return $command;
 }
 
+/*
+ * Called by drush_parse_command and drush_redispatch
+ */
+function _drush_prepare_command(&$command, $arguments = array()) {
+  // Special case. Force help command if --help option was specified.
+  if (drush_get_option(array('h', 'help'))) {
+    $arguments = array($command['command']);
+    $command = $implemented['help'];
+    $command['arguments'] = $arguments;
+  }
+  else {
+    // Merge specified callback arguments, which precede the arguments passed on the command line.
+    if (isset($command['callback arguments']) && is_array($command['callback arguments'])) {
+      $arguments = array_merge($command['callback arguments'], $arguments);
+    }
+  }
+  $command['arguments'] = $arguments;
+}
+
 /**
  * Invoke drush api calls.
  *
Index: includes/drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/drush.inc,v
retrieving revision 1.153
diff -u -p -r1.153 drush.inc
--- includes/drush.inc	3 Dec 2010 08:11:07 -0000	1.153
+++ includes/drush.inc	4 Dec 2010 15:24:33 -0000
@@ -11,6 +11,14 @@
  */
 define('DRUSH_DRUPAL_KILOBYTE', 1024);
 
+/**
+ * Given a command record, dispatch it as if it were
+ * the original command.  @see drush_core_topic.
+ */
+function drush_redispatch($command, $arguments = array()) {
+  _drush_prepare_command($command, $arguments);
+  drush_dispatch($command);
+}
 
 /**
  * Dispatch a given set of commands.
@@ -965,20 +973,27 @@ function _drush_shell_exec($args, $inter
   }
 
   if (!drush_get_context('DRUSH_SIMULATE')) {
-    exec($command . ($interactive ? '' : ' 2>&1'), $output, $result);
-    _drush_shell_exec_output_set($output);
+    if ($interactive) {
+      $result = proc_open($command, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes);
+      proc_close($result);
+      return ($result !== FALSE);
+    }
+    else {
+      exec($command . ($interactive ? '' : ' 2>&1'), $output, $result);
+      _drush_shell_exec_output_set($output);
 
-    if (drush_get_context('DRUSH_DEBUG')) {
-      foreach ($output as $line) {
-        drush_print($line, 2);
+      if (drush_get_context('DRUSH_DEBUG')) {
+	foreach ($output as $line) {
+          drush_print($line, 2);
+	}
       }
-    }
 
-    // Exit code 0 means success.
-    return ($result == 0);
+      // Exit code 0 means success.
+      return ($result == 0);
+    }
   }
   else {
-    return 0;
+    return TRUE;
   }
 }
 
@@ -1125,7 +1140,15 @@ function drush_print($message = '', $ind
  *   Full path to a file.
  */
 function drush_print_file($file) {
-  drush_print(file_get_contents($file));
+  if (drush_shell_exec_interactive("less %s", $file)) {
+    return;
+  }
+  elseif (drush_shell_exec_interactive("more %s", $file)) {
+    return;
+  }
+  else {
+    drush_print(file_get_contents($file));
+  }
 }
 
 /**
