You are here

function drush_features_update in Features 7.2

Same name and namespace in other branches
  1. 6 features.drush.inc \drush_features_update()
  2. 7 features.drush.inc \drush_features_update()

Drush command callback for 'features-update'.

Updates an existing feature module.

File

./features.drush.inc, line 631
Features module drush integration.

Code

function drush_features_update() {
  if ($args = func_get_args()) {
    foreach ($args as $module) {
      if (($feature = features_load_feature($module, TRUE)) && module_exists($module)) {
        _drush_features_export($feature->info, $feature->name, dirname($feature->filename));
      }
      elseif ($feature) {
        _features_drush_set_error($module, 'FEATURES_FEATURE_NOT_ENABLED');
      }
      else {
        _features_drush_set_error($module);
      }
    }
  }
  else {

    // By default just show contexts that are available.
    $rows = array(
      array(
        dt('Available features'),
      ),
    );
    foreach (features_get_features(NULL, TRUE) as $name => $info) {
      $rows[] = array(
        $name,
      );
    }
    drush_print_table($rows, TRUE);
  }
}