Created
July 10, 2014 13:58
-
-
Save midwire/8ed5d0dd33c71bcccfbe to your computer and use it in GitHub Desktop.
Notify after a long-running shell command
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/env ruby | |
require "rubygems" | |
require "thor" | |
require 'terminal-notifier' | |
class NotifyAfter < Thor | |
desc "after ARGS", | |
"ARGS is the after and list of arguments to run, after which you will be notified." | |
method_option :verbose, | |
:type => :boolean, | |
:default => false, | |
:required => false, | |
:aliases => "-v" | |
def after(*args) | |
# puts ">>> args: [#{args.join(' ')}]" | |
binary = args.shift | |
cmdline = "#{binary} #{args.join(' ')}" | |
output = `#{cmdline}` | |
puts(output) | |
TerminalNotifier.notify("Finished", :title => "#{binary} command") | |
end | |
end | |
NotifyAfter.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment