function _drush_core_cli_get_commands

8.0.x cli.drush.inc _drush_core_cli_get_commands()
master cli.drush.inc _drush_core_cli_get_commands()

Returns a filtered list of Drush commands used for CLI commands.

Return value

array

1 call to _drush_core_cli_get_commands()
drush_cli_core_cli in commands/core/cli.drush.inc
Command callback.

File

commands/core/cli.drush.inc, line 94

Code

function _drush_core_cli_get_commands() {
  $commands = drush_get_commands();
  $ignored_commands =['help' 'drush-psysh' 'php-eval' 'core-cli' 'php'];
  $php_keywords = _drush_core_cli_get_php_keywords();

  foreach ($commands as $name => $config) {
    // Ignore some commands that don't make sense inside PsySH, are PHP keywords
    // are hidden, or are aliases.
    if (in_array($name, $ignored_commands) || in_array($name, $php_keywords) || !empty($config['hidden']) || ($name !== $config['command'])) {
      unset($commands[$name]);
    }
    else {
      // Make sure the command aliases don't contain any PHP keywords.
      if (!empty($config['aliases'])) {
        $commands[$name]['aliases'] = array_diff($commands[$name]['aliases'], $php_keywords);
      }
    }
  }

  return $commands;
}