Class: Pair::Cli::Notify

Inherits:
Pair::Cli show all
Defined in:
lib/pair/cli/notify.rb

Instance Attribute Summary

Attributes inherited from Pair::Cli

#arguments, #options

Instance Method Summary collapse

Methods inherited from Pair::Cli

#initialize, run!

Constructor Details

This class inherits a constructor from Pair::Cli

Instance Method Details

#parse!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pair/cli/notify.rb', line 10

def parse!
  opts = parse do |opts|
    opts.banner = "Usage #{$0.split("/").last} notify" +
                  "\n\n" +
                  "Options:" +
                  "\n"

    opts.on("-t", "--title title") do |title|
      options[:title] = title
    end

    opts.on("-n", "--notification name") do |name|
      options[:name] = name
    end

    opts.on("-m", "--message text") do |text|
      options[:text] = text
    end

    opts.on("-i", "--icon url") do |url|
      options[:icon] = url
    end

    opts.on("-s", "--sticky") do
      options[:sticky] = true
    end
  end
end

#run!Object



4
5
6
7
8
# File 'lib/pair/cli/notify.rb', line 4

def run!
  parse!

  Notification.dispatcher.gntp_notify(options)
end