Class: ImapTickler::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/imap_tickler/cli.rb

Class Method Summary collapse

Class Method Details

.execute(input, output, arguments = []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/imap_tickler/cli.rb', line 6

def self.execute(input,output,arguments=[])
  options = {:config_file => "~/.imap_tickler.conf"}
  parser = OptionParser.new do |opts|
    opts.banner = <<-BANNER.gsub(/^          /,'')
        Usage: #{File.basename($0)} [options]

        Options are:
    BANNER
    opts.on( "-F path", "", String,
            "Load an alternate config file") do |opt|
      options[:config_file] = opt
            end
  end
  parser.parse(arguments)
  config = YAML.load_file(File.expand_path(options[:config_file]))
  Tickler.new(config).start
end