twsh 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/myun2/twitter_shell/ls.rb +28 -14
- data/lib/myun2/twitter_shell/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1997c7c0bb311a30dede083c6e024a72b3ccf32
|
4
|
+
data.tar.gz: 72f9973cd886d24b21a976a8694d6da79c6985f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a72d808e4d2c254e937fe1493d1cfeaeb774d4c1a4f474e46c3e536f90c67d955711b7f6c4a140e4efb8bc5320fc56cedb37818cfc358170c7118edc1bea9d5
|
7
|
+
data.tar.gz: ad20708fad91eaa0cd829e3f2306a5a351ec722e5a7aa59d86bfb70a7dbf212ab49c4486b1fd26a23dfd328914e83a6c4a60875bece4b640bdea51d06799567f
|
data/README.md
CHANGED
@@ -29,8 +29,11 @@ $ update <post text>
|
|
29
29
|
# Tweet post text.
|
30
30
|
|
31
31
|
$ ls
|
32
|
+
$ ls mention
|
33
|
+
$ ls -l
|
32
34
|
# Show your home-timeline (shown 30 charactors tweet text, and only 20 tweets count.)
|
33
|
-
# Option '
|
35
|
+
# Option 'mention': mention timeline
|
36
|
+
# Option '-l': detail timeline (timestamp and user id, full tweet text)
|
34
37
|
|
35
38
|
$ tail
|
36
39
|
# Realtime show your home-timeline
|
@@ -7,26 +7,40 @@ module Myun2
|
|
7
7
|
|
8
8
|
def initialize(client, *params)
|
9
9
|
@client = client
|
10
|
-
|
10
|
+
|
11
|
+
if params && params.length > 0
|
12
|
+
case
|
13
|
+
when params[0] == '-m' || params[0] == 'mention' || params[0] == 'mentions'
|
14
|
+
timeline = mentions_timeline
|
15
|
+
params.shift
|
16
|
+
end
|
17
|
+
end
|
18
|
+
timeline ||= home_timeline
|
19
|
+
|
20
|
+
timeline.each do |t|
|
21
|
+
puts format(t, *params)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def mentions_timeline
|
26
|
+
client.mentions
|
11
27
|
end
|
12
28
|
|
13
29
|
def home_timeline
|
14
30
|
client.home_timeline
|
15
31
|
end
|
16
32
|
|
17
|
-
def format(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"<#{user_name}>: #{text[0..30]}"
|
29
|
-
end
|
33
|
+
def format(tweet, *params)
|
34
|
+
u = tweet['user']
|
35
|
+
user_name = u['name']
|
36
|
+
screen_name = u['screen_name']
|
37
|
+
text = tweet['text']
|
38
|
+
|
39
|
+
if params && params.length > 0 && params[0][0] == '-' && params[0].include?('l')
|
40
|
+
datetime = tweet['created_at']
|
41
|
+
"#{datetime} <#{screen_name}:#{user_name}>: #{text}"
|
42
|
+
else
|
43
|
+
"<#{user_name}>: #{text[0..30]}"
|
30
44
|
end
|
31
45
|
end
|
32
46
|
end
|