Created
July 31, 2012 15:36
-
-
Save ttscoff/3217879 to your computer and use it in GitHub Desktop.
A quick shell script that wraps the terminal-notifier for quick Mountain Lion notifications when a process finishes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# finished: a quick script to notify you when a command is done using Mountain Lion notifications | |
# It grabs the current folder as the title and takes one argument as the message | |
# Example: make && make install && finished "Done compiling" || finished "compiler failed" | |
# | |
# Needs the terminal-notifier gem : `gem install terminal-notifier` | |
# Can alternately be used with the CLI <https://github.com/alloy/terminal-notifier> | |
# (remove require block below and swap comment lines at the bottom) | |
require 'rubygems' | |
require 'terminal-notifier' | |
message = ARGV[0] || "Task completed" | |
project = Dir.pwd.split('/')[-3..-1].join('/') | |
activate = 'com.googlecode.iterm2' | |
TerminalNotifier.notify(message, :activate => activate, :title => "Finished in #{project}") | |
# %x{/usr/bin/terminal-notifier -message "#{message}" -title "Finished in #{project}" -activate #{activate}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment