t 2.10.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/t/cli.rb +15 -13
- data/lib/t/identicon.rb +2 -2
- data/lib/t/printable.rb +35 -31
- data/lib/t/rcfile.rb +3 -6
- data/lib/t/version.rb +2 -2
- data/t.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dffb68d3ffef0b5d653209a7425f779dfb0f7f64
|
4
|
+
data.tar.gz: c5d04c93f764afdb52ad1677eade5ea03bd4a419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c738537629fa02755015171b36d9739f6a0ec76ffe0099d2cd9da8bd1b1cc3610d431940e0f166c945f2966ea9b290d4af25e9f610c9ecd82648bf637e909453
|
7
|
+
data.tar.gz: aa99c2748440cbffd11e680bdfb8b6d7f1d3351e4bba0b5a0d0d9e253432ea286cd0c677af0e2379055b961687b342b375ea61d4651a5b4f659dc347203df0a7
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ First, make sure you have Ruby installed.
|
|
28
28
|
|
29
29
|
If the output looks something like this, you're in good shape:
|
30
30
|
|
31
|
-
ruby
|
31
|
+
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
|
32
32
|
|
33
33
|
If the output looks more like this, you need to [install Ruby][ruby]:
|
34
34
|
[ruby]: https://www.ruby-lang.org/en/downloads/
|
@@ -197,10 +197,11 @@ example, here's how to send a user a direct message only if they already follow
|
|
197
197
|
#### Search Tweets you've retweeted that match a specified query
|
198
198
|
t search retweets "query"
|
199
199
|
|
200
|
-
#### Search Tweets in your timeline that match a specified query
|
200
|
+
#### Search Tweets in your home timeline that match a specified query
|
201
201
|
t search timeline "query"
|
202
|
+
**Note**: In Twitter API parlance, your “home timeline” is your “Newsfeed” whereas your “user timeline” are the tweets tweeted (and retweeted) by you.
|
202
203
|
|
203
|
-
#### Search Tweets in
|
204
|
+
#### Search Tweets in a specified user’s timeline
|
204
205
|
t search timeline @sferik "query"
|
205
206
|
|
206
207
|
## Features
|
@@ -287,10 +288,10 @@ the original code.
|
|
287
288
|
This library aims to support and is [tested against][travis] the following Ruby
|
288
289
|
implementations:
|
289
290
|
|
290
|
-
* Ruby 1.9.3
|
291
291
|
* Ruby 2.0.0
|
292
292
|
* Ruby 2.1
|
293
293
|
* Ruby 2.2
|
294
|
+
* Ruby 2.3
|
294
295
|
|
295
296
|
If something doesn't work on one of these Ruby versions, it's a bug.
|
296
297
|
|
data/lib/t/cli.rb
CHANGED
@@ -778,7 +778,7 @@ module T
|
|
778
778
|
end
|
779
779
|
map %w(tl) => :timeline
|
780
780
|
|
781
|
-
desc 'trends [WOEID]', 'Returns the top
|
781
|
+
desc 'trends [WOEID]', 'Returns the top 50 trending topics.'
|
782
782
|
method_option 'exclude-hashtags', aliases: '-x', type: :boolean, desc: 'Remove all hashtags from the trends list.'
|
783
783
|
def trends(woe_id = 1)
|
784
784
|
opts = {}
|
@@ -796,18 +796,20 @@ module T
|
|
796
796
|
method_option 'unsorted', aliases: '-u', type: :boolean, desc: 'Output is not sorted.'
|
797
797
|
def trend_locations
|
798
798
|
places = client.trend_locations
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
799
|
+
unless options['unsorted']
|
800
|
+
places = case options['sort']
|
801
|
+
when 'country'
|
802
|
+
places.sort_by { |place| place.country.downcase }
|
803
|
+
when 'parent'
|
804
|
+
places.sort_by { |place| place.parent_id.to_i }
|
805
|
+
when 'type'
|
806
|
+
places.sort_by { |place| place.place_type.downcase }
|
807
|
+
when 'woeid'
|
808
|
+
places.sort_by { |place| place.woeid.to_i }
|
809
|
+
else
|
810
|
+
places.sort_by { |place| place.name.downcase }
|
811
|
+
end
|
812
|
+
end
|
811
813
|
places.reverse! if options['reverse']
|
812
814
|
if options['csv']
|
813
815
|
require 'csv'
|
data/lib/t/identicon.rb
CHANGED
@@ -30,7 +30,7 @@ module T
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def bg(bit)
|
33
|
-
bit
|
33
|
+
bit.zero? ? "\033[48;5;#{@bcolor}m" : "\033[48;5;#{@fcolor}m"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -43,7 +43,7 @@ module T
|
|
43
43
|
|
44
44
|
def digest(string)
|
45
45
|
require 'digest'
|
46
|
-
Digest::MD5.digest(string).chars.inject(0) { |
|
46
|
+
Digest::MD5.digest(string).chars.inject(0) { |acc, elem| (acc << 8) | elem.ord }
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/lib/t/printable.rb
CHANGED
@@ -53,18 +53,20 @@ module T
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def print_lists(lists)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
56
|
+
unless options['unsorted']
|
57
|
+
lists = case options['sort']
|
58
|
+
when 'members'
|
59
|
+
lists.sort_by(&:member_count)
|
60
|
+
when 'mode'
|
61
|
+
lists.sort_by(&:mode)
|
62
|
+
when 'since'
|
63
|
+
lists.sort_by(&:created_at)
|
64
|
+
when 'subscribers'
|
65
|
+
lists.sort_by(&:subscriber_count)
|
66
|
+
else
|
67
|
+
lists.sort_by { |list| list.slug.downcase }
|
68
|
+
end
|
69
|
+
end
|
68
70
|
lists.reverse! if options['reverse']
|
69
71
|
if options['csv']
|
70
72
|
require 'csv'
|
@@ -136,7 +138,7 @@ module T
|
|
136
138
|
# Save 6 chars for icon, ensure at least 3 lines long
|
137
139
|
lines = wrapped(HTMLEntities.new.decode(message), indent: 2, width: terminal_width - (6 + 5))
|
138
140
|
lines.unshift(set_color(" @#{from_user}", :bold, :yellow))
|
139
|
-
lines.
|
141
|
+
lines.concat(Array.new([3 - lines.length, 0].max) { '' })
|
140
142
|
|
141
143
|
$stdout.puts lines.zip(icon.lines).map { |x, i| " #{i || ' '}#{x}" }
|
142
144
|
end
|
@@ -181,24 +183,26 @@ module T
|
|
181
183
|
end
|
182
184
|
|
183
185
|
def print_users(users) # rubocop:disable CyclomaticComplexity
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
186
|
+
unless options['unsorted']
|
187
|
+
users = case options['sort']
|
188
|
+
when 'favorites'
|
189
|
+
users.sort_by { |user| user.favorites_count.to_i }
|
190
|
+
when 'followers'
|
191
|
+
users.sort_by { |user| user.followers_count.to_i }
|
192
|
+
when 'friends'
|
193
|
+
users.sort_by { |user| user.friends_count.to_i }
|
194
|
+
when 'listed'
|
195
|
+
users.sort_by { |user| user.listed_count.to_i }
|
196
|
+
when 'since'
|
197
|
+
users.sort_by(&:created_at)
|
198
|
+
when 'tweets'
|
199
|
+
users.sort_by { |user| user.statuses_count.to_i }
|
200
|
+
when 'tweeted'
|
201
|
+
users.sort_by { |user| user.status? ? user.status.created_at : Time.at(0) } # rubocop:disable BlockNesting
|
202
|
+
else
|
203
|
+
users.sort_by { |user| user.screen_name.downcase }
|
204
|
+
end
|
205
|
+
end
|
202
206
|
users.reverse! if options['reverse']
|
203
207
|
if options['csv']
|
204
208
|
require 'csv'
|
data/lib/t/rcfile.rb
CHANGED
@@ -17,11 +17,8 @@ module T
|
|
17
17
|
|
18
18
|
def find(username)
|
19
19
|
possibilities = Array(find_case_insensitive_match(username) || find_case_insensitive_possibilities(username))
|
20
|
-
|
21
|
-
|
22
|
-
else
|
23
|
-
fail(ArgumentError.new("Username #{username} is #{possibilities.size < 1 ? 'not found.' : 'ambiguous, matching ' + possibilities.join(', ')}"))
|
24
|
-
end
|
20
|
+
raise(ArgumentError.new("Username #{username} is #{possibilities.empty? ? 'not found.' : 'ambiguous, matching ' + possibilities.join(', ')}")) unless possibilities.size == 1
|
21
|
+
possibilities.first
|
25
22
|
end
|
26
23
|
|
27
24
|
def find_case_insensitive_match(username)
|
@@ -118,7 +115,7 @@ module T
|
|
118
115
|
|
119
116
|
def write
|
120
117
|
require 'yaml'
|
121
|
-
File.open(@path, File::RDWR | File::TRUNC | File::CREAT,
|
118
|
+
File.open(@path, File::RDWR | File::TRUNC | File::CREAT, 0o0600) do |rcfile|
|
122
119
|
rcfile.write @data.to_yaml
|
123
120
|
end
|
124
121
|
end
|
data/lib/t/version.rb
CHANGED
data/t.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.add_dependency 'oauth', '~> 0.4.7'
|
11
11
|
spec.add_dependency 'retryable', '~> 2.0'
|
12
12
|
spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
|
13
|
-
spec.add_dependency 'twitter', '~>
|
13
|
+
spec.add_dependency 'twitter', '~> 6.0'
|
14
14
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
15
15
|
spec.author = 'Erik Michaels-Ober'
|
16
16
|
spec.description = 'A command-line power tool for Twitter.'
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.licenses = %w(MIT)
|
22
22
|
spec.name = 't'
|
23
23
|
spec.require_paths = %w(lib)
|
24
|
-
spec.required_ruby_version = '>=
|
24
|
+
spec.required_ruby_version = '>= 2'
|
25
25
|
spec.summary = 'CLI for Twitter'
|
26
26
|
spec.version = T::Version
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '6.0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '6.0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: bundler
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
169
|
requirements:
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: '2'
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
175
|
- - ">="
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
179
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.5.
|
180
|
+
rubygems_version: 2.5.2
|
181
181
|
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: CLI for Twitter
|