Do

Categories

Component ID

1136530

Component name

Do

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

2304

Component created

Component changed

Component body

This project is obsolete, check out Coffee instead!

Do was inspired by Gnome Do and is an extensible tool for quick & painless Drupal site administration and development.

Usage

Press Ctrl + Space to open the dialog and type a command (this shortcut can be configured). Hit Enter to execute it.

Examples

A command be followed by unlimited parameters, separated by spaces:

command parameter1 parameter2 parameter3...

The following commands are natively supported (modules can define their own! See "Hooks" below):

alias
You can define aliases to create even simpler shortcuts for commonly used functions. Accepts two parameters: "alias" and "command". For example: alias cc cache_clear_all
goto
Redirect to an internal Drupal path
cc
Flush all caches
drush
Forward commands to Drush!

Hooks!

Use hook_do() to extend Do and create your own shortcuts and custom functionality.

In order to define a command, implement hook_do():

// array keys are optional and act as aliases for the command

function mymodule_do() {
  return array(
    'myfunction
    'my_alias' => 'other_function'
  );
}

Now, implement the function:

// commands get resolved to "MODULENAME_COMMAND"

function mymodule_myunction() {
  // do something amazing
  return array(
    'ok' => FALSE, // signal failure
    'msg' => t('Function executed!'), // display message on screen
    'redirect' => 'user' // redirect to this path, can also be an absolute URL
  );
}

function mymodule_other_function($param1, $param2) {
  // all parameters get forwarded here
  return array(
    'ok' => TRUE,
    'redirect' => TRUE, // TRUE means page gets refreshed
  );
}

Now you can quickly access your functions:

// all additional parameters get forwarded to your function
mymodule my_alias param1 param2