lib/twitter/cli/helpers.rb in jnunemaker-twitter-0.4.0 vs lib/twitter/cli/helpers.rb in jnunemaker-twitter-0.4.1

- old
+ new

@@ -6,17 +6,19 @@ def output_tweets(collection, options={}) options = { :cache => false, :since_prefix => '', - :empty_msg => 'Nothing new since your last check.' + :empty_msg => 'Nothing new since your last check.', + :reverse => false }.merge(options) if collection.size > 0 justify = collection.collect { |s| s.user.screen_name }.max { |a,b| a.length <=> b.length }.length rescue 0 indention = ' ' * (justify + 3) say("\n#{indention}#{collection.size} new tweet(s) found.\n\n") + collection.reverse! if options[:reverse] collection.each do |s| Tweet.create_from_tweet(current_account, s) if options[:cache] occurred_at = Time.parse(s.created_at).strftime('On %b %d at %l:%M%P') formatted_time = '-' * occurred_at.length + "\n#{indention}#{occurred_at}" @@ -31,10 +33,10 @@ end say "#{CGI::unescapeHTML(formatted_name)}: #{CGI::unescapeHTML(formatted_msg)}\n#{indention}#{formatted_time}\n\n" end - Configuration["#{options[:since_prefix]}_since_id"] = collection.first.id + Configuration["#{options[:since_prefix]}_since_id"] = options[:reverse] ? collection.last.id : collection.first.id else say(options[:empty_msg]) end end \ No newline at end of file