summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwjoe <joe@lc8n.com>2012-02-07 13:09:15 +0000
committerwjoe <joe@lc8n.com>2012-02-07 13:09:15 +0000
commit711b79a0e678845432c466ebfe04cd652118e162 (patch)
tree43aad3b1e61056a58c0603a91749fa786b095e5b
parent6a4bad6eaa9958676223015e7dec5be3aeab95fe (diff)
Historic commit 1.0.1 (02-Feb-2012 15:09)
-rw-r--r--blatweet.rb16
1 files 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