function drush_coder_format in Coder 7.2
Same name and namespace in other branches
- 7 coder.drush.inc \drush_coder_format()
Performs the desired coder-format command for drush.
Drush command callback for coder-format.
File
- ./
coder.drush.inc, line 45 - Drush integration for Coder module.
Code
function drush_coder_format() {
$path = drush_get_context('DRUSH_DRUPAL_ROOT');
$path .= '/' . drupal_get_path('module', 'coder') . '/scripts/coder_format/coder_format.inc';
require_once $path;
$undo = drush_get_option('undo', FALSE);
$files = func_get_args();
$cwd = drush_get_context('DRUSH_OLDCWD');
foreach ($files as $file) {
// Additionally support relative paths.
// Do this first to prevent typo disasters (e.g., $file == '/').
if (is_dir($cwd . '/' . $file)) {
coder_format_recursive($cwd . '/' . $file, $undo);
}
elseif (file_exists($cwd . '/' . $file)) {
coder_format_file($cwd . '/' . $file, $undo);
}
elseif (is_dir($file)) {
coder_format_recursive($file, $undo);
}
else {
coder_format_file($file, $undo);
}
}
}