The Drush Notify wraps integration with "growl"-like notifications in Drush-style configuration, and command-specific message generation. You can get some more details by perusing the README.

I think this functionality is pretty neat, and by tuning your drush configuration to whitelist commands, or set a "running too long" sort of time limit, you can have your notifications only when you need it. I think the community would benefit from the increased visibility.

CommentFileSizeAuthor
#1 2020291-1-drush_notify.patch6.35 KBGrayside
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grayside’s picture

Status: Active » Needs work
FileSize
6.35 KB

The attached patch is a conversion of the original command to a core command with the "notify" namespace.
I think some extract of the README should be pulled into the docs, but I'm not sure where. Also, tests.

moshe weitzman’s picture

Issue tags: +Needs tests

Looking good.

I would expect to find pm-download specific code in pm/download.drush.inc. I think that would be a good model for other commands that want to implement custom handling.

Greg.1.Anderson had mentioned a --notify-auto= option which one could set in a drushrc and user would automatically be notified for any long running commands. I haven't considered if thats the best implementation, but it is a neat feature.

Anyone have a clue how to notify on windows?

greg.1.anderson’s picture

The patch in #1 supports --notify=60 (notify on completion for commands that execute for more than 60 seconds), which I think is as good as if not better than --notify --notify-auto=60. You can specify default --notify timeouts in drushrc.php files, or command-specific options, and --notify on the cli will override the default value as usual. Works for me.

In 'drush_notify_command_allowed', the $command record is not needed any longer.

notify_drush_help_alter works, but since this is in Drush core now, we could just move these items into drush_get_global_options in drush.inc.

Finally, as an optional enhancement, something that would make this really cool would be to introduce a way to indicate that drush_log should also appear in the notification message after the command completes. This facility could be used in place of notify_drush_pm_post_download in the patch above. I think if we simply defined that all log messages of type 'success' should become notification messages, that things would pretty much just work out the way most users would expect. We might have to review existing log messages and switch some 'success' logs to 'ok', and visa-versa, but a casual review of existing 'success' messages leads me to believe that we're already pretty much on the right track if we go this route.

Grayside’s picture

@greg.1.anderson this started as a way of demonstrating adding core options, which I don't believe I've otherwise seen a contrib project do. I am fine merging it fully into core options, unless you think there is value in having it as an example.

Sending success logs is interesting, I'll look closer at that when I next reroll the patch--probably Friday.

Grayside’s picture

Assigned: Unassigned » Grayside
moshe weitzman’s picture

Any progress, Grayside?

moshe weitzman’s picture

Status: Needs work » Fixed
Issue tags: +Needs change record

Committed to 6.x with minor cleanups. Thanks Grayside. A few thoughts:

  1. I made it so that if you pass notify-audio alone, you get both text and audio alert. Should they work independantly or will you almost always want both?
  2. I didn't improve the success or error messages. I think that would be great. The only downside is that verbose messages are tedious with audio but I think audio is always tedious so maybe thats just me.
  3. I'm interested in cleanups that move the code to where it belongs (e..g global options, no special case for pm-download, no more register_shutdown, ...)

Lets open new issues for those as needed.

Grayside’s picture

Fantastic! My last couple weeks ran away with me, I will have one or two follow-up patches in the works.

helmo’s picture

Status: Fixed » Needs work
There was 1 failure:
1) completeCase::testComplete
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'--n: (l) --nocolor'
+'--n: (l) --notify-audio'
/home/travis/build/helmo/drush/tests/completeTest.php:189
/home/travis/build/helmo/drush/tests/completeTest.php:97

Suggested fix: https://github.com/helmo/drush/commit/fc797ea022aff71f1cc962f04802c1b4fb...

moshe weitzman’s picture

Status: Needs work » Fixed

Automatically closed -- issue fixed for 2 weeks with no activity.