Sha256: a80c64825bd2347c809ea110340b9168f3ac19d81d106e0c24efc609f1d44261

Contents?: true

Size: 1.35 KB

Versions: 8

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Example OS X growlnotify 1.2.2 notify-send wrapper script.

require 'optparse'


options = {}
OptionParser.new do |opts|
  opts.on('-u', '--urgency LEVEL')           { |v| options[:u] = v } # TO DO: set to --priority
  opts.on('-t', '--expire-time TIME')        { |v| options[:t] = v } # Option gets removed
  opts.on('-a', '--app-name APP_NAME')       { |v| options[:a] = v } # Set to --name 
  opts.on('-i', '--icon ICON[,ICON...]')     { |v| options[:i] = v } # Set to --image
  opts.on('-c', '--category TYPE[,TYPE...]') { |v| options[:c] = v } # Option gets removed
  opts.on('-h', '--hint TYPE:NAME:VALUE')    { |v| options[:h] = v } # Option gets removed
  opts.on('-v', '--version')                 { |v| options[:v] = v } # Option gets removed
end.parse!


if ARGV.length == 0
  puts "No summary specified"
  exit 1
elsif ARGV.length == 1
  message = "--message '#{ARGV[0]}'"
  message << " --name #{options[:a]}" if options.include?(:a) 
  message << " --image #{options[:i]}" if options.include?(:i)
elsif ARGV.length == 2
  message = "--title '#{ARGV[0]}' --message '#{ARGV[1]}'"
  message << " --name #{options[:a]}" if options.include?(:a)
  message << " --image #{options[:i]}" if options.include?(:i)
else
  puts "Invalid number of options."
  exit 1
end

system("growlnotify #{message} 2>/dev/null")

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-notify-0.6.1 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.6.0 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.5.6 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.5.5 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.5.4 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.5.3 examples/osx/growl_for_mac/notify-send.rb
vagrant-notify-0.5.2 examples/osx/notify-send_growl_for_mac
vagrant-notify-0.5.1 examples/osx/notify-send_growl_for_mac