function drush_topic_core_topic

8.0.x topic.drush.inc drush_topic_core_topic($topic_name = NULL)
6.x topic.drush.inc drush_topic_core_topic($topic_name = NULL)
7.x topic.drush.inc drush_topic_core_topic($topic_name = NULL)
4.x topic.drush.inc drush_topic_core_topic($topic_name = NULL)
5.x topic.drush.inc drush_topic_core_topic($topic_name = NULL)
master topic.drush.inc drush_topic_core_topic($topic_name = NULL)

A command callback.

Show a choice list of available topics and then dispatch to the respective command.

Parameters

string $topic_name: A command name.

File

commands/core/topic.drush.inc, line 53
Topic command and associated hooks.

Code

function drush_topic_core_topic($topic_name = NULL) {
  $commands = drush_get_commands();
  if (is_null($topic_name)) {
    // Show choice list.
    foreach (drush_get_topics() as $key => $topic) {
      $choices[$key] = $topic['description'];
    }
    natcasesort($choices);
    if (!$topic_name = drush_choice($choices, dt('Choose a topic'), '!value (!key)')) {
      return;
    }
  }
  // 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_dispatch($commands[$topic_name]);
}