Created
October 19, 2010 00:10
-
-
Save joker1007/633336 to your computer and use it in GitHub Desktop.
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
require "rubygems" | |
require "trollop" | |
require "ruby_gntp" | |
opts = Trollop::options do | |
opt :name, "Notification Name", :default => "growlnotify" | |
opt :host, "Target Host", :short => "-H", :default => "localhost" | |
opt :password, "Growl password", :type => :string | |
opt :image, "Icon file", :type => :string | |
opt :message, "Notification body", :type => :string, :required => true | |
opt :stick, "Sticky mode" | |
end | |
title = ARGV[0] | |
options = { | |
:host => opts[:host], | |
:app_name => opts[:name], | |
:title => title, | |
:text => opts[:message], | |
:icon => opts[:image] | |
} | |
options.merge!(:passwd => opts[:password]) if opts[:password] | |
options.merge!(:sticky => true) if opts[:stick] | |
GNTP.notify(options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment