Sha256: 75f7013a538aa70493e9aa105a846a596f9425df0d2305bde65be6a98dfcb267

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

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

# Example OS X (>= 10.9) applescript notify-send wrapper script.

require 'optparse'


options = {}
OptionParser.new do |opts|
  opts.on('-u', '--urgency LEVEL')           { |v| options[:u] = v } # Option gets removed
  opts.on('-t', '--expire-time TIME')        { |v| options[:t] = v } # Option gets removed
  opts.on('-a', '--app-name APP_NAME')       { |v| options[:a] = v } # TO DO: Set to -title
  opts.on('-i', '--icon ICON[,ICON...]')     { |v| options[:i] = v } # Option gets removed
  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 = "\"#{ARGV[0]}\""
elsif ARGV.length == 2
  message = "\"#{ARGV[0]}\" with title \"#{ARGV[1]}\""
else
  puts "Invalid number of options."
  exit 1
end

system "osascript -e 'display notification #{message} sound name \"default\"'"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-notify-0.6.1 examples/osx/applescript/notify-send.rb
vagrant-notify-0.6.0 examples/osx/applescript/notify-send.rb
vagrant-notify-0.5.6 examples/osx/applescript/notify-send.rb