t 3.1.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.md +1 -1
- data/README.md +8 -9
- data/bin/t +21 -21
- data/lib/t/cli.rb +470 -463
- data/lib/t/collectable.rb +9 -8
- data/lib/t/core_ext/kernel.rb +3 -3
- data/lib/t/core_ext/string.rb +2 -2
- data/lib/t/delete.rb +44 -41
- data/lib/t/editor.rb +5 -5
- data/lib/t/identicon.rb +1 -1
- data/lib/t/list.rb +51 -51
- data/lib/t/printable.rb +69 -65
- data/lib/t/rcfile.rb +18 -17
- data/lib/t/requestable.rb +3 -2
- data/lib/t/search.rb +82 -82
- data/lib/t/set.rb +21 -21
- data/lib/t/stream.rb +67 -60
- data/lib/t/utils.rb +25 -25
- data/lib/t/version.rb +2 -2
- data/lib/t.rb +2 -2
- data/t.gemspec +22 -21
- metadata +29 -49
data/lib/t/utils.rb
CHANGED
@@ -3,45 +3,45 @@ module T
|
|
3
3
|
private
|
4
4
|
|
5
5
|
# https://github.com/rails/rails/blob/bd8a970/actionpack/lib/action_view/helpers/date_helper.rb
|
6
|
-
def distance_of_time_in_words(from_time, to_time = Time.now) # rubocop:disable CyclomaticComplexity
|
6
|
+
def distance_of_time_in_words(from_time, to_time = Time.now) # rubocop:disable Metrics/CyclomaticComplexity
|
7
7
|
seconds = (to_time - from_time).abs
|
8
8
|
minutes = seconds / 60
|
9
9
|
case minutes
|
10
10
|
when 0...1
|
11
11
|
case seconds
|
12
12
|
when 0...1
|
13
|
-
|
13
|
+
"a split second"
|
14
14
|
when 1...2
|
15
|
-
|
15
|
+
"a second"
|
16
16
|
when 2...60
|
17
|
-
format(
|
17
|
+
format("%<seconds>d seconds", seconds:)
|
18
18
|
end
|
19
19
|
when 1...2
|
20
|
-
|
20
|
+
"a minute"
|
21
21
|
when 2...60
|
22
|
-
format(
|
22
|
+
format("%<minutes>d minutes", minutes:)
|
23
23
|
when 60...120
|
24
|
-
|
24
|
+
"an hour"
|
25
25
|
# 120 minutes up to 23.5 hours
|
26
26
|
when 120...1410
|
27
|
-
format(
|
27
|
+
format("%<hours>d hours", hours: (minutes.to_f / 60.0).round)
|
28
28
|
# 23.5 hours up to 48 hours
|
29
29
|
when 1410...2880
|
30
|
-
|
30
|
+
"a day"
|
31
31
|
# 48 hours up to 29.5 days
|
32
32
|
when 2880...42_480
|
33
|
-
format(
|
33
|
+
format("%<days>d days", days: (minutes.to_f / 1440.0).round)
|
34
34
|
# 29.5 days up to 60 days
|
35
35
|
when 42_480...86_400
|
36
|
-
|
36
|
+
"a month"
|
37
37
|
# 60 days up to 11.5 months
|
38
38
|
when 86_400...503_700
|
39
|
-
format(
|
39
|
+
format("%<months>d months", months: (minutes.to_f / 43_800.0).round)
|
40
40
|
# 11.5 months up to 2 years
|
41
41
|
when 503_700...1_051_200
|
42
|
-
|
42
|
+
"a year"
|
43
43
|
else
|
44
|
-
format(
|
44
|
+
format("%<years>d years", years: (minutes.to_f / 525_600.0).round)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
alias time_ago_in_words distance_of_time_in_words
|
@@ -49,7 +49,7 @@ module T
|
|
49
49
|
|
50
50
|
def fetch_users(users, options)
|
51
51
|
format_users!(users, options)
|
52
|
-
require
|
52
|
+
require "retryable"
|
53
53
|
users = Retryable.retryable(tries: 3, on: Twitter::Error, sleep: 0) do
|
54
54
|
yield users
|
55
55
|
end
|
@@ -57,29 +57,29 @@ module T
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def format_users!(users, options)
|
60
|
-
require
|
61
|
-
options[
|
60
|
+
require "t/core_ext/string"
|
61
|
+
options["id"] ? users.collect!(&:to_i) : users.collect!(&:strip_ats)
|
62
62
|
end
|
63
63
|
|
64
64
|
def extract_owner(user_list, options)
|
65
|
-
owner, list_name = user_list.split(
|
65
|
+
owner, list_name = user_list.split("/")
|
66
66
|
if list_name.nil?
|
67
67
|
list_name = owner
|
68
68
|
owner = @rcfile.active_profile[0]
|
69
69
|
else
|
70
|
-
require
|
71
|
-
owner = options[
|
70
|
+
require "t/core_ext/string"
|
71
|
+
owner = options["id"] ? owner.to_i : owner.strip_ats
|
72
72
|
end
|
73
73
|
[owner, list_name]
|
74
74
|
end
|
75
75
|
|
76
76
|
def strip_tags(html)
|
77
|
-
html.gsub(/<.+?>/,
|
77
|
+
html.gsub(/<.+?>/, "")
|
78
78
|
end
|
79
79
|
|
80
|
-
def number_with_delimiter(number, delimiter =
|
81
|
-
digits = number.to_s.
|
82
|
-
groups = digits.reverse.each_slice(3).collect
|
80
|
+
def number_with_delimiter(number, delimiter = ",")
|
81
|
+
digits = number.to_s.chars
|
82
|
+
groups = digits.reverse.each_slice(3).collect(&:join)
|
83
83
|
groups.join(delimiter).reverse
|
84
84
|
end
|
85
85
|
|
@@ -88,7 +88,7 @@ module T
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def decode_full_text(message, decode_full_uris = false)
|
91
|
-
require
|
91
|
+
require "htmlentities"
|
92
92
|
text = HTMLEntities.new.decode(message.full_text)
|
93
93
|
text = decode_uris(text, message.uris) if decode_full_uris
|
94
94
|
text
|
data/lib/t/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module T
|
2
2
|
class Version
|
3
|
-
MAJOR =
|
3
|
+
MAJOR = 4
|
4
4
|
MINOR = 1
|
5
5
|
PATCH = 0
|
6
6
|
PRE = nil
|
@@ -8,7 +8,7 @@ module T
|
|
8
8
|
class << self
|
9
9
|
# @return [String]
|
10
10
|
def to_s
|
11
|
-
[MAJOR, MINOR, PATCH, PRE].compact.join(
|
11
|
+
[MAJOR, MINOR, PATCH, PRE].compact.join(".")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/lib/t.rb
CHANGED
data/t.gemspec
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "t/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.add_dependency
|
8
|
-
spec.add_dependency
|
9
|
-
spec.add_dependency
|
10
|
-
spec.add_dependency
|
11
|
-
spec.add_dependency
|
12
|
-
spec.add_dependency
|
13
|
-
spec.add_dependency
|
14
|
-
spec.
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
spec.
|
18
|
-
spec.
|
19
|
-
spec.
|
20
|
-
spec.
|
21
|
-
spec.
|
22
|
-
spec.name =
|
23
|
-
spec.require_paths = %w
|
24
|
-
spec.required_ruby_version =
|
25
|
-
spec.summary =
|
8
|
+
spec.add_dependency "geokit", "~> 1.14"
|
9
|
+
spec.add_dependency "htmlentities", "~> 4.3"
|
10
|
+
spec.add_dependency "launchy", "~> 3.0"
|
11
|
+
spec.add_dependency "oauth", "~> 1.1"
|
12
|
+
spec.add_dependency "retryable", "~> 3.0"
|
13
|
+
spec.add_dependency "thor", "~> 1.3"
|
14
|
+
spec.add_dependency "twitter", "~> 8.1"
|
15
|
+
spec.author = "Erik Berlin"
|
16
|
+
spec.description = "A command-line power tool for Twitter."
|
17
|
+
spec.email = "sferik@gmail.com"
|
18
|
+
spec.executables = Dir["bin/*"].map { |f| File.basename(f) }
|
19
|
+
spec.files = %w[CONTRIBUTING.md LICENSE.md README.md t.gemspec] + Dir["bin/*"] + Dir["lib/**/*.rb"]
|
20
|
+
spec.homepage = "http://sferik.github.com/t/"
|
21
|
+
spec.licenses = %w[MIT]
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
23
|
+
spec.name = "t"
|
24
|
+
spec.require_paths = %w[lib]
|
25
|
+
spec.required_ruby_version = ">= 3.1.4"
|
26
|
+
spec.summary = "CLI for Twitter"
|
26
27
|
spec.version = T::Version
|
27
28
|
end
|
metadata
CHANGED
@@ -1,133 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Erik
|
8
|
-
autorequire:
|
7
|
+
- Erik Berlin
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: geokit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.14'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: htmlentities
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: launchy
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: oauth
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '1.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '1.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: retryable
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: thor
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.19.1
|
90
|
-
- - "<"
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '2'
|
93
|
-
type: :runtime
|
94
|
-
prerelease: false
|
95
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 0.19.1
|
100
|
-
- - "<"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '2'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: twitter
|
105
85
|
requirement: !ruby/object:Gem::Requirement
|
106
86
|
requirements:
|
107
87
|
- - "~>"
|
108
88
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
89
|
+
version: '1.3'
|
110
90
|
type: :runtime
|
111
91
|
prerelease: false
|
112
92
|
version_requirements: !ruby/object:Gem::Requirement
|
113
93
|
requirements:
|
114
94
|
- - "~>"
|
115
95
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
96
|
+
version: '1.3'
|
117
97
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
98
|
+
name: twitter
|
119
99
|
requirement: !ruby/object:Gem::Requirement
|
120
100
|
requirements:
|
121
101
|
- - "~>"
|
122
102
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1
|
124
|
-
type: :
|
103
|
+
version: '8.1'
|
104
|
+
type: :runtime
|
125
105
|
prerelease: false
|
126
106
|
version_requirements: !ruby/object:Gem::Requirement
|
127
107
|
requirements:
|
128
108
|
- - "~>"
|
129
109
|
- !ruby/object:Gem::Version
|
130
|
-
version: '1
|
110
|
+
version: '8.1'
|
131
111
|
description: A command-line power tool for Twitter.
|
132
112
|
email: sferik@gmail.com
|
133
113
|
executables:
|
@@ -160,8 +140,9 @@ files:
|
|
160
140
|
homepage: http://sferik.github.com/t/
|
161
141
|
licenses:
|
162
142
|
- MIT
|
163
|
-
metadata:
|
164
|
-
|
143
|
+
metadata:
|
144
|
+
rubygems_mfa_required: 'true'
|
145
|
+
post_install_message:
|
165
146
|
rdoc_options: []
|
166
147
|
require_paths:
|
167
148
|
- lib
|
@@ -169,16 +150,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
150
|
requirements:
|
170
151
|
- - ">="
|
171
152
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
153
|
+
version: 3.1.4
|
173
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
155
|
requirements:
|
175
156
|
- - ">="
|
176
157
|
- !ruby/object:Gem::Version
|
177
158
|
version: '0'
|
178
159
|
requirements: []
|
179
|
-
|
180
|
-
|
181
|
-
signing_key:
|
160
|
+
rubygems_version: 3.5.9
|
161
|
+
signing_key:
|
182
162
|
specification_version: 4
|
183
163
|
summary: CLI for Twitter
|
184
164
|
test_files: []
|