Class: Feed2Mail::CLI

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

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



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

def self.run(args)
  config = Feed2Mail::Config.new
  config.load

  OptionParser.new do |o|
    o.banner = "Usage: #{File.basename $0} [options]"
    o.on '-v', '--verbose', 'verbose mode' do |v|
      config.verbose = v
    end
    o.on_tail '-h', '--help', 'show this message' do
      puts o
      exit
    end
  end.parse!

  report = Feed2Mail::Report.new config
  report.update

  report.mail :from => '[email protected]', :to => '[email protected]'
end