jugyo-termtter 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/plugin/stdout.rb +1 -1
- data/lib/termtter/twitter.rb +5 -1
- data/lib/termtter/version.rb +1 -1
- metadata +1 -1
data/lib/plugin/stdout.rb
CHANGED
@@ -60,4 +60,4 @@ end
|
|
60
60
|
# output statuses to stdout
|
61
61
|
# example config
|
62
62
|
# configatron.plugins.stdout.colors = [:none, :red, :green, :yellow, :blue, :magenta, :cyan]
|
63
|
-
# configatron.plugins.stdout.timeline_format = '
|
63
|
+
# configatron.plugins.stdout.timeline_format = '<90><%=time%></90> <<%=status_color%>><%=status%></<%=status_color%>> <90><%=id%></90>'
|
data/lib/termtter/twitter.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
require 'highline'
|
4
|
+
require 'termcolor'
|
4
5
|
require 'time'
|
5
6
|
|
6
7
|
module Termtter
|
@@ -49,12 +50,15 @@ module Termtter
|
|
49
50
|
return []
|
50
51
|
end
|
51
52
|
|
53
|
+
configatron.search.set_default(:highlihgt_text_format, '<on_magenta><white>\1</white></on_magenta>')
|
52
54
|
def search(query)
|
53
55
|
results = fetch_as_json(search_url_for("/search.json?q=#{CGI.escape(query)}"))['results']
|
54
56
|
return results.map do |s|
|
55
57
|
status = Status.new
|
56
58
|
status.id = s['id']
|
57
|
-
status.text = CGI.unescapeHTML(s['text']).
|
59
|
+
status.text = CGI.unescapeHTML(s['text']).
|
60
|
+
gsub(/(\n|\r)/, '').
|
61
|
+
gsub(/(#{Regexp.escape(query)})/i, configatron.search.highlihgt_text_format)
|
58
62
|
status.created_at = Time.parse(s["created_at"])
|
59
63
|
status.user_screen_name = s['from_user']
|
60
64
|
status
|
data/lib/termtter/version.rb
CHANGED