function drush_notify_send_text

8.0.x notify.drush.inc drush_notify_send_text($msg)
6.x notify.drush.inc drush_notify_send_text($msg)
7.x notify.drush.inc drush_notify_send_text($msg)
master notify.drush.inc drush_notify_send_text($msg)

Send text-based system notification.

This is the automatic, default behavior. It is intended for use with tools such as libnotify in Linux and Notification Center on OSX.

Parameters

string $msg: Message text for delivery.

Return value

bool TRUE on success, FALSE on failure

1 call to drush_notify_send_text()
drush_notify_send in commands/core/notify.drush.inc
Prepares and dispatches notifications to delivery mechanisms.

File

commands/core/notify.drush.inc, line 134
Add system notifications as a new drush option.

Code

function drush_notify_send_text($msg) {
  $override = drush_get_option('notify-cmd', FALSE);

  if (!empty($override)) {
    $cmd = $override;
  }
  else {
    switch (PHP_OS) {
      case 'Darwin':
        $cmd = 'terminal-notifier -message %s -title Drush';
        $error_message = dt('terminal-notifier command failed. Please install it from https://github.com/alloy/terminal-notifier.');
        break;
      case 'Linux':
      default:
        $icon = drush_normalize_path(DRUSH_BASE_PATH . '/drush_logo-black.png');
        $cmd = "notify-send %s -i $icon";
        $error_message = dt('notify-send command failed. Please install it as per http://coderstalk.blogspot.com/2010/02/how-to-install-notify-send-in-ubuntu.html.');
        break;
    }
  }

  if (!drush_shell_exec($cmd, $msg)) {
    return drush_set_error('NOTIFY_COMMAND_NOT_FOUND', $error_message . ' ' . dt('Or you may specify an alternate command to run by specifying --notify-cmd=<my_command>'));
  }

  return TRUE;
}