Sha256: b2a029753e1cc2e3a7ff2db2f405d16145cf15c0734f839ba4b18a009190bafe

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

#!/usr/bin/env ruby

require 'thor'
require 'yaml'
require 'tinynews'


module TinyNews

  f = File.open( "sources.yml", "r" ).read
  SOURCES = YAML::load( f )

  class TinyNewsCLI < Thor

    default_task :news_from_source

    desc "list", "Lists the available news feeds."
    def list
      puts "List of news feed sources: "
      SOURCES.each do |symbol, source|
        puts "- #{source[:title]}"
      end
    end

    desc "--source NEWS_SOURCE", "Show news for NEWS_SOURCE"
    option :source, :required => true, :aliases => :s
    def news_from_source
      TinyNews.print_to_cli( options[:source].to_sym )
    end
  end

end

TinyNews::TinyNewsCLI.start( ARGV )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tinynews-1.0.0 bin/tinynews