#!/usr/bin/ruby =begin Usage: atom-show [options] source displays a feed human-readably 'source' can be a path on the local filesystem, the URL of an Atom Collection or '-' for stdin. =end require 'atom/tools' include Atom::Tools def parse_options options = { } opts = OptionParser.new do |opts| opts.banner = < 1 puts opts exit end options end if __FILE__ == $0 require 'optparse' options = parse_options source = ARGV[0] source ||= '-' entries = parse_input source, options entries.each do |e| puts e.title if options[:content] if options[:content].zero? puts e.content.to_s else puts e.content.to_s.split(' ')[0,options[:content]].join(' ') end end puts end end