'drush_callback_help', 'description' => 'View help. Run "drush help command" to view command-specific help.' ); return $items; } /** * Command callback. Display help. */ function drush_callback_help() { $commands = func_get_args(); // Display general help text if no command is specified. if (empty($commands)) { drush_print('drush ' . drush_version()); drush_print(t('Usage: drush [options] ...')); drush_print(); drush_print(t('Options: ')); // TODO: Add a hook for this, to allow other modules to add their options $rows[] = array('-r , --root=', t("Drupal root directory to use (default: current directory)")); $rows[] = array('-l , --uri=', t('URI of the drupal site to use (only needed in multisite environments)')); $rows[] = array('-v, --verbose', t('Display all available output')); $rows[] = array('-y, --yes', t("Assume 'yes' as answer to all prompts")); $rows[] = array('-s, --simulate', t("Simulate all relevant actions (don't actually change the system)")); drush_print_table($rows, 2); drush_print(); drush_print('Commands: '); $commands = drush_get_commands(); $rows = array(); foreach($commands as $key => $command) { $rows[] = array($key, $commands[$key]['description']); } drush_print_table($rows, 2); } // Print command specific help. else { $commandstring = implode(" ", $commands); if (!drush_is_command($commandstring)) { return drush_error(t('Invalid command !command.', array('!command' => implode(" ", $commands)))); } $help = module_invoke_all('help', 'drush:'. $commandstring); if (!empty($help)) { drush_print(implode("\n", $help)); } else { drush_print(t("No help available for command 'drush $commandstring'.")); } } } /** * This is called if no command or an unknown command is entered. */ function drush_usage() { $commands = func_get_args(); if (drush_get_option('version')) { return drush_print('drush ' . drush_version()); } if (drush_get_option('help') || empty($commands)) { return drush_callback_help(); } return drush_error(t('Invalid command !command.', array('!command' => implode(" ", $commands)))); }