Sha256: 197f09d9c1c02b19c5ebecf5a39633d9f17991ae922b485bdd7a569a35e3ccbc

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

#!/bin/env ruby

begin
  load 'lib/rrimm.rb'
rescue LoadError
  require 'rrimm'
end

require 'optparse'

options = {
  'action' => :sync,
  'conf_file' => File.join(ENV['HOME'], '.config', 'rrimm', 'rrimm.rb'),
  'concurrency' => 1,
}

OptionParser.new do |opts|
  opts.banner = "Usage: rrimm "
  opts.on('-c', '--config [file]',
          'configuration file used by rrimm') do |conf_file|
    options['conf_file'] = conf_file
  end

  opts.on('-C', '--concurrency N',
          'concurrency level to fetch feeds. Default 1') do |c|
    options['concurrency'] = c.to_i
  end

  opts.on('-a', '--action [action]', [:sync, :show],
          'Specify what to do: "sync" feeds, "show" config') do |action|
    options['action'] = action
  end

  opts.on_tail("-h", "--help", "You know what it does") do
    puts opts
    exit
  end
end.parse!(ARGV)



conf = RRImm::Config.new
conf.load(options['conf_file'])

fetcher = RRImm::Fetcher.new(conf)

case options['action']
when :sync
  fetcher.parallel_fetch(options['concurrency'])
when :show
  conf.show
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rrimm-0.1.1 bin/rrimm
rrimm-0.1.0 bin/rrimm