You are here

function features_drush_command in Features 7.2

Same name and namespace in other branches
  1. 8.4 drush/features.drush8.inc \features_drush_command()
  2. 8.3 drush/features.drush8.inc \features_drush_command()
  3. 6 features.drush.inc \features_drush_command()
  4. 7 features.drush.inc \features_drush_command()

Implements hook_drush_command().

Return value

An associative array describing your command(s).

See also

drush_parse_command()

File

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

Code

function features_drush_command() {
  $items = array();

  // If Features is enabled display the configured default export path,
  // otherwise just show the default.
  if (defined('FEATURES_DEFAULT_EXPORT_PATH')) {
    $path = variable_get('features_default_export_path', FEATURES_DEFAULT_EXPORT_PATH);
  }
  else {
    $path = 'sites/all/modules';
  }

  /* @see \drush_features_list() */
  $items['features-list'] = array(
    'description' => "List all the available features for your site.",
    'options' => array(
      'status' => "Feature status, can be 'enabled', 'disabled'  or 'all'",
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fl',
      'features',
    ),
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'list',
      'field-labels' => array(
        'name' => 'Name',
        'feature' => 'Feature',
        'status' => 'Status',
        'version' => 'Version',
        'state' => 'State',
      ),
      'output-data-type' => 'format-table',
    ),
  );

  /* @see \drush_features_export() */
  $items['features-export'] = array(
    'description' => "Export a feature from your site into a module.",
    'arguments' => array(
      'feature' => 'Feature name to export.',
      'components' => 'Patterns of components to include, see features-components for the format of patterns.',
    ),
    'options' => array(
      'destination' => "Destination path (from Drupal root) of the exported feature. Defaults to '" . $path . "'.",
      'version-set' => "Specify a version number for the feature.",
      'version-increment' => "Increment the feature's version number.",
      'ignore-conflicts' => "Ignore conflicts and export all components.",
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fe',
    ),
  );

  /* @see \drush_features_add() */
  $items['features-add'] = array(
    'description' => "Add a component to a feature module. (DEPRECATED: use features-export)",
    'arguments' => array(
      'feature' => 'Feature name to add to.',
      'components' => 'List of components to add.',
    ),
    'options' => array(
      'version-set' => "Specify a version number for the feature.",
      'version-increment' => "Increment the feature's version number.",
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fa',
    ),
  );

  /* @see \drush_features_components() */
  $items['features-components'] = array(
    'description' => 'List features components.',
    'arguments' => array(
      'patterns' => 'The features components type to list. Omit this argument to list all components.',
    ),
    'options' => array(
      'exported' => array(
        'description' => 'Show only components that have been exported.',
      ),
      'not-exported' => array(
        'description' => 'Show only components that have not been exported.',
      ),
      'info-style' => array(
        'description' => 'Export components in format suitable for using in an info file.',
      ),
    ),
    'aliases' => array(
      'fc',
    ),
  );

  /* @see \drush_features_update() */
  $items['features-update'] = array(
    'description' => "Update a feature module on your site.",
    'arguments' => array(
      'feature' => 'A space delimited list of features.',
    ),
    'options' => array(
      'version-set' => "Specify a version number for the feature.",
      'version-increment' => "Increment the feature's version number.",
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fu',
    ),
  );

  /* @see \drush_features_update_all() */
  $items['features-update-all'] = array(
    'description' => "Update all feature modules on your site.",
    'arguments' => array(
      'feature_exclude' => 'A space-delimited list of features to exclude from being updated.',
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fu-all',
      'fua',
    ),
  );

  /* @see \drush_features_revert() */
  $items['features-revert'] = array(
    'description' => "Revert a feature module on your site.",
    'arguments' => array(
      'feature' => 'A space delimited list of features or feature.component pairs.',
    ),
    'options' => array(
      'force' => "Force revert even if Features assumes components' state are default.",
    ),
    'examples' => array(
      'drush fr foo.node foo.taxonomy bar' => 'Revert node and taxonomy components of feature "foo", but only if they are overriden. Revert all overriden components of feature "bar".',
      'drush fr foo.node foo.taxonomy bar --force' => 'Revert node and taxonomy components of feature "foo". Revert all components of feature "bar".',
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fr',
    ),
  );

  /* @see \drush_features_revert_all() */
  $items['features-revert-all'] = array(
    'description' => "Revert all enabled feature module on your site.",
    'arguments' => array(
      'feature_exclude' => 'A space-delimited list of features to exclude from being reverted.',
    ),
    'options' => array(
      'force' => "Force revert even if Features assumes components' state are default.",
    ),
    'drupal dependencies' => array(
      'features',
    ),
    'aliases' => array(
      'fr-all',
      'fra',
    ),
  );

  /* @see \drush_features_diff() */
  $items['features-diff'] = array(
    'description' => "Show the difference between the default and overridden state of a feature.",
    'arguments' => array(
      'feature' => 'The feature in question.',
    ),
    'options' => array(
      'ctypes' => 'Comma separated list of component types to limit the output to. Defaults to all types.',
      'lines' => 'Generate diffs with <n> lines of context instead of the usual two.',
    ),
    'drupal dependencies' => array(
      'features',
      'diff',
    ),
    'aliases' => array(
      'fd',
    ),
  );

  /* @see \drush_features_diff_all() */
  $items['features-diff-all'] = array(
    'description' => "Show the code difference for all enabled features not in their default state.",
    'arguments' => array(
      'feature_exclude' => 'A space-delimited list of features to exclude from being reverted.',
    ),
    'options' => array(
      'force' => "Bypass the confirmations. This is useful if you want to output all of the diffs to a log file.",
    ),
    'drupal dependencies' => array(
      'features',
      'diff',
    ),
    'aliases' => array(
      'fda',
    ),
  );
  return $items;
}