function drush_core_help

8.0.x help.drush.inc drush_core_help()
6.x help.drush.inc drush_core_help()
7.x help.drush.inc drush_core_help()
3.x core.drush.inc drush_core_help()
4.x help.drush.inc drush_core_help()
5.x help.drush.inc drush_core_help()
master help.drush.inc drush_core_help($name = '')

This is called if no command or an unknown command is entered.

File

commands/core/core.drush.inc, line 242
Core drush commands.

Code

function drush_core_help() {
  $commands = func_get_args();

  if (drush_get_option('html')) {
    return drush_print(drush_help_html());
  }
  elseif (empty($commands)) {
    drush_show_help(array('help'));
    $phases = _drush_bootstrap_phases();
    // For speed, only bootstrap up to DRUSH_BOOTSTRAP_DRUPAL_SITE+1.
    $phases = array_slice($phases, 0, DRUSH_BOOTSTRAP_DRUPAL_SITE + 1);
    drush_print(dt('Commands: '));

    $printed_rows = array();
    $phase_index = DRUSH_BOOTSTRAP_DRUSH;

    foreach ($phases as $phase_index) {
      if (drush_bootstrap_validate($phase_index)) {
        if ($phase_index > drush_get_context('DRUSH_BOOTSTRAP_PHASE')) {
          drush_bootstrap($phase_index);
        }

        $commands = drush_get_commands();
        // Filter by command file if specified.
        if ($commandfile = drush_get_option('filter')) {
          foreach ($commands as $key => $candidate) {
            if ($candidate['commandfile'] != $commandfile) {
              unset($commands[$key]);
            }
          }
        }

        $rows = array();
        ksort($commands);
        foreach ($commands as $key => $command) {
          if (!$command['hidden']) {
            if (!array_key_exists('is_alias', $command) || !$command['is_alias']) {
              if (!array_key_exists($key, $printed_rows)) {
                $name = $command['aliases'] ? $key . ' (' . implode(', ', $command['aliases']) . ')' : $key;
                $rows[$key] = array($name, $command['description']);
                $pipe[] = "\"$key\"";
              }
            }
          }
        }
        drush_print_table($rows, FALSE, array(0 => 20));
        $printed_rows = array_merge($printed_rows, $rows);
      }
      else {
        break;
      }
    }

    // Newline-delimited list for use by other scripts. Set the --pipe option.
    drush_print_pipe($pipe);
    return;
  }
  else {
    return drush_show_help($commands);
  }

  drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt('Invalid command !command.', array('!command' => implode(" ", $commands))));
}