function drush_command_include

8.0.x command.inc drush_command_include($command)
6.x command.inc drush_command_include($command)
7.x command.inc drush_command_include($command)
3.x command.inc drush_command_include($command)
4.x command.inc drush_command_include($command)
5.x command.inc drush_command_include($command)
master command.inc drush_command_include($command)

Conditionally include files based on the command used.

Steps through each of the currently loaded commandfiles and loads an optional commandfile based on the key.

When a command such as 'pm-enable' is called, this function will find all 'enable.pm.inc' files that are present in each of the commandfile directories.

1 call to drush_command_include()
drush_invoke in includes/command.inc
Invoke drush api calls.

File

includes/command.inc, line 606
The drush command engine.

Code

function drush_command_include($command) {
  $parts = explode('-', $command);
  $command = implode(".", array_reverse($parts));

  $commandfiles = drush_commandfile_list();
  $options = array();
  foreach ($commandfiles as $commandfile => $file) {
    $filename = sprintf("%s/%s.inc", dirname($file), $command);
    if (file_exists($filename)) {
      drush_log(dt('Including !filename', array('!filename' => $filename)), 'bootstrap');
      include_once ($filename);
    }
  }
}