I’m sure you’re all thrilled to know that I’ve made a little bit of progress on Bulletin, my command line based RSS reader. This is all still building-block stuff, but now Bulletin properly parses and displays your NewsGator folder hierarchy, like mine, below:

Hooray! As usual, you can keep track of Bulletin’s progress at its GitHub repository.
Rather than sleep, I’ve decided to improve (read: radically bloat) uproar.rb.
uproar.rb
# uproar.rb - search a YAML-encoded list of links for matching tags
# ardekantur.com
%w[ rubygems yaml open-uri hpricot ].each { |x| require x }
def set_option hash, name, default
i = ARGV.index(name)
hash[name] = i ? ARGV[i + 1] : default
end
def search_tags file, tag
links = File.open( file )
db = []
YAML::load_documents( links ) { |doc| db << doc }
matches = []
db.each { |l| matches << l if l['tags'].include? tag }
matches.each { |l| printf "%30s... - %s\n", l['title'][0..30], l['link'] }
end
def add_link file, address, tags
doc = Hpricot(open(address))
title = doc.at("title").inner_html.strip
puts "Adding '#{title}' to #{file}..."
links = File.new( file, "a" )
links.puts "\n---"
links.puts "title: '#{title.gsub(/'/, '\'\'')}'"
links.puts "link: #{address}"
tags = tags ? tags.strip.gsub(/ /, ', ') : ''
links.puts "tags: [#{tags}]"
links.close
end
o = {}
set_option o, '-s', nil
set_option o, '-f', 'Links.yaml'
set_option o, '-t', ''
set_option o, '-a', nil
raise "please specify either a tag to search for or a link to add." if (!o['-s'] and !o['-a']) or (o['-s'] and o['-a'])
search_tags o['-f'], o['-s'] if o['-s']
add_link o['-f'], o['-a'], o['-t'] if o['-a']
New functionality! Specify your links file with -f filename.yaml. Searching with tags now uses -s tag instead of -t tag. Adding a link works like this: ruby Uproar.rb -a http://webaddress.com/ -t "space separated list of tags". The title is grabbed automagically for you :)