You are here

function key_drush_command in Key 7.3

Same name and namespace in other branches
  1. 8 drush/key.drush.inc \key_drush_command()

Implements hook_drush_command().

File

drush/key.drush.inc, line 19

Code

function key_drush_command() {
  $items['key-save'] = array(
    'description' => dt('Save a key.'),
    'examples' => array(
      'drush key-save secret_password \'pA$$w0rd\' --label="Secret password" --key-type=authentication --key-provider=config --key-input=text_field' => 'Define a key for a password to use for authentication using the Configuration key provider.',
      'drush key-save encryption_key --label="Encryption key" --key-type=encryption --key-type-settings=\'{"key_size":256}\' --key-provider=file --key-provider-settings=\'{"file_location":"private://keys/encryption.key", "base64_encoded":true}\' --key-input=none' => 'Define a key to use for encryption using the File key provider.',
    ),
    'arguments' => array(
      'id' => dt('The ID (machine name) of the key to save.'),
      'key_value' => dt('A key value to save. May or may not be allowed or required, depending on the key provider'),
    ),
    'required-arguments' => 1,
    'options' => key_drush_save_options(),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  );
  $items['key-delete'] = array(
    'description' => dt('Delete a key.'),
    'arguments' => array(
      'id' => dt('The ID (machine name) of the key to delete.'),
    ),
    'required-arguments' => TRUE,
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  );
  $items['key-list'] = array(
    'description' => dt('Display a list of available keys.'),
    'options' => array(
      'key-type' => array(
        'description' => dt('An optional, comma-delimited list of key types. To see a list of available key types, use `drush key-type-list`.'),
        'example-value' => 'authentication,encryption',
      ),
      'key-provider' => array(
        'description' => dt('An optional, comma-delimited list of key providers. To see a list of available key providers, use `drush key-provider-list`.'),
        'example-value' => 'config,file',
      ),
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'list',
      'field-labels' => array(
        'id' => 'ID',
        'label' => 'Label',
        'key_type' => 'Type',
        'key_provider' => 'Provider',
      ),
      'output-data-type' => 'format-table',
    ),
  );
  $items['key-type-list'] = array(
    'description' => dt('Display a list of available key types.'),
    'options' => array(
      'group' => array(
        'description' => dt('An optional key type group on which to filter.'),
        'example-value' => 'authentication,encryption',
      ),
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'list',
      'field-labels' => array(
        'id' => 'ID',
        'description' => 'Description',
      ),
      'output-data-type' => 'format-table',
    ),
  );
  $items['key-provider-list'] = array(
    'description' => dt('Display a list of available key providers.'),
    'options' => array(
      'storage-method' => array(
        'description' => dt('An optional key provider storage method on which to filter.'),
        'example-value' => 'config,file',
      ),
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'list',
      'field-labels' => array(
        'id' => 'ID',
        'description' => 'Description',
      ),
      'output-data-type' => 'format-table',
    ),
  );
  $items['key-value-get'] = array(
    'description' => dt('Get a key value.'),
    'arguments' => array(
      'id' => dt('The ID (machine name) of the key whose value should be retrieved.'),
    ),
    'required-arguments' => TRUE,
    'options' => array(
      'base64' => dt('Base64-encode the key value. This is useful in the case of binary encryption keys that would otherwise not be displayed in a readable way.'),
      'pipe' => dt('Print just the key value, and nothing else.'),
    ),
    'aliases' => array(
      'key-value',
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
    'outputformat' => array(
      'default' => 'key-value',
      'pipe-format' => 'string',
      'label' => 'Key value',
      'output-data-type' => 'format-single',
    ),
  );
  return $items;
}