Skip to content

Instantly share code, notes, and snippets.

@add20
Forked from ttscoff/finished.rb
Last active December 16, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save add20/5433630 to your computer and use it in GitHub Desktop.
Save add20/5433630 to your computer and use it in GitHub Desktop.
#!/usr/bin/env 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.apple.Terminal'
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