Sha256: df4617917fb1d01784aea4c0a80944551ac84c61d0d8e58c7c0d32421c76eda8

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 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)

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prss-0.2.4 lib/prss/cli.rb
prss-0.2.3 lib/prss/cli.rb
prss-0.2.2 lib/prss/cli.rb
prss-0.2.1 lib/prss/cli.rb
prss-0.2.0 lib/prss/cli.rb
prss-0.1.1 lib/prss/cli.rb