-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add notifications for newly added formulae #3
Comments
I'm going to do it like this on my system now (see below); it would open the Cakebrew app, which is kinda useful because it will give me additional information on the newly added formula(e): if printf "%s" "$out" | /usr/bin/grep "New Formulae"; then |
I can see that as being useful, and also as being not useful. ;-) So it would need some kind of way to turn it on or off. I don't really see a good place to do that, though. Homebrew uses environment variables for all its customization. Would that work here? |
Not sure. At any rate, my method doesn't seem to work. Grepping "New Formulae" will produce the additional notification, which is great, but I just found out that Cakebrew doesn't have a menu for new formulae. It only lists them in the output window when you manually update homebrew, just like in the Terminal. So my method above is useless. Basically I'm just looking for a way to add to your script one notification for every newly added formula. (This wouldn't clutter the display, because there's usually only one new formula or so per day.) So I guess there are two ways: (1) grep "New Formula", and if out = true, then parse the names of the new formulae in the next line or next few lines of the command line output, then send every formula title into its own notification window. (2) Or add a new launchd process that runs independently, with a script that simply makes a copy of the list of all the available formulae, compares old vs new after a Homebrew update, and if a new one was added, it puts out a notification. That would have the benefit that it would leave your script alone. :) EDIT: For option (1) switching on/off "new formula notifications" one could, I assume, do that with one variable, which the user has to set to true or false manually; personally I write those things into a plist in the user preferences folder, and the script then reads the relevant key, in this case e.g. '0' and '1', off and on. |
I may have found a way to do it (see below). One possible problem might be the following: If homebrew is updated, and there are no changes except newly added formulae, it might not put out a notification on every formula, because sed runs up to "==>", and if there is no second section, i.e. no second "==>" in $out, it might drop the output's last line, and if there's only one line of output, it might drop it altogether. That's what happened with the output echoed from a test textfile, Don't know if this will happen in real life as well. Have to try it out. If the problem persists, it might get more complicated. EDIT: I simply appended "==> End" to $out, wrote that into $outEXT, and use that new variable; a bit dirty, but it works.
|
Nope. Doesn't work either. Worked with a textfile containing test output, but not in real life. (No idea yet.) |
Hi there, thanks a lot for the homebrew-auto-update. Really like it. One question though: would it be possible to include notifications when new formulae have been added, i.e. not just upgrades to formulae installed on the user's system, but completely new ones that have been added for installation since the last update? EDIT: not sure if there's a command for that, but it should be possible to grep new formulae, with one notification window for each new formula (possibly).
The text was updated successfully, but these errors were encountered: