function computing_drush_command in Drupal Computing 7
Same name and namespace in other branches
- 7.2 computing.drush.inc \computing_drush_command()
Implements hook_drush_command().
File
- ./
computing.drush.inc, line 12 - Drupal Hybrid Computing drush interface. To use this, please install Drush at http://drupal.org/project/drush
Code
function computing_drush_command() {
$items = array();
$items['computing-create'] = array(
'description' => "Create a computing record directly from drush",
//'aliases' => array('ca'),
'drupal dependencies' => array(
'computing',
),
'arguments' => array(
'app' => 'App name of this command.',
'command' => 'Please write down the command. Remember to enclose spaces in double quotes.',
'description' => 'Description of this command. Enclose spaces in double quotes.',
'fields' => 'Vertical bar separated key-value pairs, or "-" to read STDIN. Eg. field1=value1|field2=value2.',
),
'options' => array(
'json' => 'Fields is in json rather than the key-value pairs',
),
//'callback' => 'computing_create_record',
//'callback arguments' => array('default'),
'examples' => array(
'drush computing-add your_app your_command your_description "field1=value1|field1=value2"' => "Create 'your_command'. Remember to enclose spaces into double quotes.",
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
);
$items['computing-purge'] = array(
'description' => 'Remove all commands where status is not null.',
//'drupal dependencies' => array('computing'),
//'aliases' => array('cpurge'),
'options' => array(
'force' => 'Controls whether to purge all command records or finished ones.',
),
'examples' => array(
'drush computing-purge' => 'Purge all finished commands.',
'drush computing-purge --force' => 'Purge all commands.',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_DATABASE,
);
$items['computing-list'] = array(
'description' => 'List computing records.',
//'drupal dependencies' => array('computing'),
//'aliases' => array('cpurge'),
'options' => array(
'all' => 'Controls whether to list all records, or records not processed yet..',
),
'examples' => array(
'drush computing-list' => 'List active records not getting processed.',
'drush computing-list --all' => 'List all commands.',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_DATABASE,
);
$items['computing-call'] = array(
'description' => 'Call any Drupal/PHP functions and print results as json for further process. All parameters must be josn.',
'hidden' => TRUE,
//'examples' => array(
// 'drush computing-call "node_load 1"' => 'Display node 1 data in json',
//),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
);
// copied some code from php-eval in core.drush.inc.
$items['computing-eval'] = array(
'description' => 'Call any Drupal/PHP snippet and print results as json for further process.',
'hidden' => TRUE,
'arguments' => array(
'code' => 'PHP code, or "-" to read code from STDIN',
),
'required-arguments' => TRUE,
'examples' => array(
'drush computing-eval "$nid=1; return node_load($nid);"' => 'Display node 1 data in json',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
);
return $items;
}