Sha256: 12ae60498e4bf4faafea46627d0a42c7032c25d7e222f5c9d42bc1a5a3e4542a

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 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.1 bin/tinynews