From 711b79a0e678845432c466ebfe04cd652118e162 Mon Sep 17 00:00:00 2001 From: wjoe Date: Tue, 7 Feb 2012 13:09:15 +0000 Subject: Historic commit 1.0.1 (02-Feb-2012 15:09) --- blatweet.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/blatweet.rb b/blatweet.rb index b6c7f94..cef1f83 100644 --- a/blatweet.rb +++ b/blatweet.rb @@ -4,6 +4,7 @@ require 'optparse' username = nil number_of_tweets = 1 +output = '' STDIN.gets.split(' ').each{|arg| ARGV << arg} if ARGV == [] args = ARGV.dup @@ -27,8 +28,15 @@ Twitter.configure do |config| config.oauth_token_secret = 'YxnmXtywSbIvJHyX6pdGhDnkQiR2Z1KJ84DQyzVpUk' end -if username - Twitter.search("from:#{username}", :rpp => number_of_tweets, :result_type => "recent").each{|tweet| puts tweet.text} -else - Twitter.update ARGV.join ' ' +begin + if username + Twitter.search("from:#{username}", :rpp => number_of_tweets, :result_type => "recent").each{|tweet| output += "#{tweet.text}\n"} + puts output + else + Twitter.update ARGV.join ' ' + end +rescue Twitter::Error => e + puts e.message +rescue StandardError => e + puts e.message end -- cgit v1.2.3