twsh 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f2e5b6dd45c3fbeb49d4ac1bf0452463c33a88c
4
- data.tar.gz: 52b7611d17335f45067648b95485e2e9f4ec6d1f
3
+ metadata.gz: fa64b3f8a82910c23caed89b682655797b5a0fc6
4
+ data.tar.gz: 0b33a2346c6b616f08f18f83f0062a3200de04c4
5
5
  SHA512:
6
- metadata.gz: 7b69c0f6dc9b8deeb33eacaaa371555f4fbbc1b5d6a180bc0706272d3f157e923b2c17d85cf1cf38549f1f9a09d7cad3480045433ea1001c1accb5a43d950094
7
- data.tar.gz: a9e1c440625863909ddc9f337c9ae3c9ff9c4dd50a75fd408122f94479512d1fd0a5d21d247aacab27d9dd4ee585248c4b7f3728edfcfc8fd89df7f332cf3b4b
6
+ metadata.gz: 891d28a954811f1e1009cff3075056efeca6cdf9a2e0c8aaef32d72277c1201ebded0eab2963041455dea8bcaeb953b841fa0c71801daee433ad931e7647c998
7
+ data.tar.gz: da65d50fd1cbbb00a40d85b8444266c0c8f21e3b78f1f7e2a4d0dc99550ed416836f8668bad41e0a76aac18fa3d9c3b730746a723c027412b38c54cebc5165ae
data/README.md CHANGED
@@ -34,6 +34,7 @@ $ ls -l
34
34
  # Show your home-timeline (shown 30 charactors tweet text, and only 20 tweets count.)
35
35
  # Option 'mention': mention timeline
36
36
  # Option '-l': detail timeline (timestamp and user id, full tweet text)
37
+ # Option '-c=<count>': tweet count specify
37
38
 
38
39
  $ tail
39
40
  # Realtime show your home-timeline
@@ -11,30 +11,30 @@ module Myun2
11
11
  if params && params.length > 0
12
12
  case
13
13
  when params[0] == '-m' || params[0] == 'mention' || params[0] == 'mentions'
14
- timeline = mentions_timeline
15
14
  params.shift
15
+ timeline = mentions_timeline(*params)
16
16
  when params[0][0] != '-'
17
- timeline = user_timeline(params[0])
18
- params.shift
17
+ user_name = params.shift
18
+ timeline = user_timeline(user_name, *params)
19
19
  end
20
20
  end
21
- timeline ||= home_timeline
21
+ timeline ||= home_timeline(*params)
22
22
 
23
23
  timeline.each do |t|
24
24
  puts format(t, *params)
25
25
  end
26
26
  end
27
27
 
28
- def user_timeline(screen_name)
29
- client.user_timeline(screen_name: screen_name)
28
+ def user_timeline(screen_name, *params)
29
+ client.user_timeline({ screen_name: screen_name }.merge(params_to_options *params))
30
30
  end
31
31
 
32
- def mentions_timeline
33
- client.mentions
32
+ def mentions_timeline(*params)
33
+ client.mentions(params_to_options *params)
34
34
  end
35
35
 
36
- def home_timeline
37
- client.home_timeline
36
+ def home_timeline(*params)
37
+ client.home_timeline(params_to_options *params)
38
38
  end
39
39
 
40
40
  def format(tweet, *params)
@@ -50,6 +50,15 @@ module Myun2
50
50
  "<#{user_name}>: #{text[0..30]}"
51
51
  end
52
52
  end
53
+
54
+ private
55
+ def params_to_options(*params)
56
+ options = {}
57
+ params.each do |param|
58
+ options[:count] = $1.to_i if /\A-c=(\d+)\Z/ =~ param
59
+ end
60
+ options
61
+ end
53
62
  end
54
63
  end
55
64
  end
@@ -1,5 +1,5 @@
1
1
  module Myun2
2
2
  class TwitterShell
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - myun2