diff --git a/lib/earthquake/commands.rb b/lib/earthquake/commands.rb index 931a90d..3e38efd 100644 --- a/lib/earthquake/commands.rb +++ b/lib/earthquake/commands.rb @@ -200,17 +200,18 @@ command :search do |m| search_options = config[:search_options] ? config[:search_options].dup : {} + words = m[1].shellsplit.map{|x| + case x + when /^from:(.+)/, /^to:(.+)/ + $1 + when /^-/, "AND", "OR" + else + x + end + }.compact puts_items twitter.search(m[1], search_options)["results"].each { |s| s["user"] = {"screen_name" => s["from_user"]} s["_disable_cache"] = true - words = m[1].split(/\s+/).reject{|x| x[0] =~ /^-|^(OR|AND)$/ }.map{|x| - case x - when /^from:(.+)/, /^to:(.+)/ - $1 - else - x - end - } s["_highlights"] = words } end