Sha256: a2cec01bfef9b9d7e3267a10a1a51ccbb568e39c8ad15c2d4d48492639412c38

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

require 'thor'

module PRSS
  class CLI < Thor


    desc 'watch PASSKEY OUTPUT', 'run in loop in given interval'
    method_option :interval, type: :numeric, default: 30, aliases: %w[-i]
    def watch(passkey, output)
      Downloader.verify!(output)
      feed = Feed.new(passkey)
      watcher = Watcher.new(feed)
      watcher.start(options[:interval], output)
    end

    desc 'download PASSKEY OUTPUT', 'fetch feed once and quit'
    def download(passkey, output)
      Downloader.verify!(output)

      feed = Feed.new(passkey)
      downloaded = feed.download_to(output_dir)

      puts "Downloaded #{downloaded.count} files to #{output_dir}."
      puts "Files:", *downloaded unless downloaded.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prss-0.1.0 lib/prss/cli.rb