function drush_cli_core_cli

8.0.x drush_cli_core_cli()
7.x drush_cli_core_cli()
master drush_cli_core_cli()

Command callback.


commands/core/, line 34


function drush_cli_core_cli() {
  $configuration = new \Psy\Configuration();
  $shell = new Shell($configuration);

  if (drush_drupal_major_version() >= 8) {
    // Register the assertion handler so exceptions are thrown instead of errors
    // being triggered. This plays nicer with PsySH.
    $shell->setScopeVariables(['container' \Drupal::getContainer()]);

    // Add Drupal 8 specific casters to the shell configuration.

  // Add Drush commands to the shell.
  $commands =[new DrushHelpCommand()];

  foreach (drush_commands_categorize(_drush_core_cli_get_commands()) as $category_data) {
    $category_title = (string) $category_data['title'];
    foreach ($category_data['commands'] as $command_config) {
      $command = new DrushCommand($command_config);
      // Set the category label on each.
      $commands[] = $command;


  // PsySH will never return control to us, but our shutdown handler will still
  // run after the user presses ^D.  Mark this command as completed to avoid a
  // spurious error message.
  drush_set_context('DRUSH_EXECUTION_COMPLETED', TRUE);

  // Run the terminate event before the shell is run. Otherwise, if the shell
  // is forking processes (the default), any child processes will close the
  // database connection when they are killed. So when we return back to the
  // parent process after, there is no connection. This will be called after the
  // command in preflight still, but the subscriber instances are already
  // created from before. Call terminate() regardless, this is a no-op for all
  // DrupalBoot classes except DrupalBoot8.
  if ($bootstrap = drush_get_bootstrap_object()) {

  // To fix the above problem in Drupal 7, the connection can be closed manually.
  // This will make sure a new connection is created again in child loops. So
  // any shutdown functions will still run ok after the shell has exited.
  if (drush_drupal_major_version() == 7) {