function drush_sandwich_make_me_a_sandwich_validate

8.0.x drush_sandwich_make_me_a_sandwich_validate()
6.x drush_sandwich_make_me_a_sandwich_validate()
7.x drush_sandwich_make_me_a_sandwich_validate()
3.x drush_sandwich_make_me_a_sandwich_validate()
4.x drush_sandwich_make_me_a_sandwich_validate()
5.x drush_sandwich_make_me_a_sandwich_validate()
master drush_sandwich_make_me_a_sandwich_validate()

Implementation of drush_hook_COMMAND_validate().

The validate command should exit with `return drush_set_error(...)` to stop execution of the command. In practice, calling drush_set_error OR returning FALSE is sufficient. See drush.api.php for more details.


examples/, line 178
Example drush command.


function drush_sandwich_make_me_a_sandwich_validate() {
  if (drush_is_windows()) {
    // $name = drush_get_username();
    // TODO: implement check for elevated process using w32api
    // as sudo is not available for Windows
  else {
    $name = posix_getpwuid(posix_geteuid());
    if ($name['name'] !== 'root') {
      return drush_set_error('MAKE_IT_YOUSELF', dt('What? Make your own sandwich.'));