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.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2020291-1-drush_notify.patch | 6.35 KB | Grayside |
Comments
Comment #1
Grayside CreditAttribution: Grayside commentedThe 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.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedLooking 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?
Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson commentedThe 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.
Comment #4
Grayside CreditAttribution: Grayside commented@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.
Comment #5
Grayside CreditAttribution: Grayside commentedComment #6
moshe weitzman CreditAttribution: moshe weitzman commentedAny progress, Grayside?
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted to 6.x with minor cleanups. Thanks Grayside. A few thoughts:
Lets open new issues for those as needed.
Comment #8
Grayside CreditAttribution: Grayside commentedFantastic! My last couple weeks ran away with me, I will have one or two follow-up patches in the works.
Comment #9
helmo CreditAttribution: helmo commentedSuggested fix: https://github.com/helmo/drush/commit/fc797ea022aff71f1cc962f04802c1b4fb...
Comment #10
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted that suggested fix. Thanks.
There is a follow-up bug report at #2035993: Fatal error: Call to undefined function drush_notify_allowed() in drush/commands/pm/download.pm.inc on line 224