Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created October 19, 2010 00:10
Show Gist options
  • Save joker1007/633336 to your computer and use it in GitHub Desktop.
Save joker1007/633336 to your computer and use it in GitHub Desktop.
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