flumtter 5.5.0 → 5.6.0

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: 13d1dedbe6e2272bfc5a0703d9ca4ac97891205f
4
- data.tar.gz: f2a259bf554cf3b41526b280b8ecf106246b492a
3
+ metadata.gz: 217e1cbdb790213ab36c4df6a07947e38cd3faad
4
+ data.tar.gz: f4409392f36fc38708a5fb639e8ecfe9b335dc19
5
5
  SHA512:
6
- metadata.gz: d2607cae78919444f5fcd1844a0cf1c0c78257ee6e97b5ad9875c0161a6452ba518e2f0022616b199213cd4022197dbd60cfc7632a8b5bb50e5a78cc715a792b
7
- data.tar.gz: ee9ea90fe2b6bb37dc88a44706ead7549680d686268e9068e284416ec5139183eb6ad9b1dd7c803e6556ca56aaf256b18dafb195f3fb844db46925b0293cc10e
6
+ metadata.gz: 39612d6048deb36ba9f3444b948275ecd413b35a5b7a876714426b6cd6494259619a18c640ab6c7cc67c52a2d309a158cfbbff2ac42c4ffff1d4afbf1c183000
7
+ data.tar.gz: 115c0227be401e4562886a78f9b399958f289bb9450617a8c6fb017432ab91cd4aa69c3d5b6a93dd115eed159f98d4f5c535a6a3652b83f58e1bf04cb119fbee
@@ -0,0 +1,93 @@
1
+ module Flumtter
2
+ module Window
3
+ class ListTypeSelector
4
+ Element = %i(owned_lists memberships subscriptions)
5
+
6
+ def self.select(twitter)
7
+ dialog = Window::Dialog.new("List Type Selector", <<~EOF)
8
+ Please input list type number.
9
+
10
+ #{Element.map.with_index{|e,i|"#{i}: #{e}"}.join("\n")}
11
+ EOF
12
+ dialog.command(/^([#{Element.size.times.to_a.join(",")}])$/) do |m|
13
+ ListSelector.new(Element[m[1].to_i], twitter).show
14
+ end
15
+ dialog.show(true)
16
+ end
17
+ end
18
+
19
+ class ListBase < Buf::Element
20
+ def element
21
+ @text ||= <<~EOF
22
+ #{header}
23
+ #{details}
24
+ EOF
25
+ end
26
+
27
+ private
28
+ def header
29
+ "#{@index}: #{@object.name} ".ljust(width, ?-)
30
+ end
31
+
32
+ def details
33
+ {
34
+ mode: @object.mode,
35
+ description: @object.description,
36
+ member_count: @object.member_count,
37
+ created_at: parse_time(@object.created_at)
38
+ }.indent(1)
39
+ end
40
+ end
41
+
42
+ class ListSelectorBuf < Buf::Buf
43
+ def initialize(type, twitter, user=twitter.account.screen_name)
44
+ @user, @type, @twitter = user, type, twitter
45
+ super(ListBase)
46
+ end
47
+
48
+ def prefetch
49
+ if @buf.empty?
50
+ adds(@twitter.rest.send(@type, @user))
51
+ end
52
+ end
53
+ end
54
+
55
+ class ListSelector < Buf::Screen
56
+ def initialize(type, twitter, user=twitter.account.screen_name)
57
+ super(ListSelectorBuf.new(type, twitter, user), "#{user} #{type}")
58
+ command(/^(\d+)$/, "list") do |m|
59
+ error_handler do
60
+ obj, _ = parse_index(m[1])
61
+ List.new(obj, twitter).show
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ class ListBuf < Buf::Buf
68
+ Options = {count: 50}
69
+
70
+ def initialize(list, twitter)
71
+ @list, @twitter = list, twitter
72
+ super(TweetBase)
73
+ end
74
+
75
+ def prefetch
76
+ adds(
77
+ @twitter.rest.list_timeline(@list.id,
78
+ @buf.last.nil? ? Options : Options.merge(max_id: @buf.last.id-1)
79
+ )
80
+ )
81
+ end
82
+ end
83
+
84
+ class List < Buf::Screen
85
+ include Command::Tweet
86
+
87
+ def initialize(list, twitter)
88
+ super(ListBuf.new(list, twitter), list.name)
89
+ add_command(twitter)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -14,6 +14,9 @@ module Flumtter
14
14
  end
15
15
  end
16
16
  end
17
+ Cli.add("--tpry", "pry with twitter instance") do |twitter|
18
+ binding.pry
19
+ end
17
20
  add_opt do |opt, options|
18
21
  opt.on('-l', '--list', 'user list') do
19
22
  puts AccountSelector.list_to_s
@@ -0,0 +1,9 @@
1
+ module Flumtter
2
+ plugin do
3
+ Keyboard.add("o", "List") do |m, twitter|
4
+ error_handler do
5
+ Window::ListTypeSelector.select(twitter)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Flumtter
2
- VERSION = "5.5.0"
2
+ VERSION = "5.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flumtter
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0
4
+ version: 5.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - flum1025
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,6 +159,7 @@ files:
159
159
  - lib/flumtter/app/core/windows/favorite.rb
160
160
  - lib/flumtter/app/core/windows/follower.rb
161
161
  - lib/flumtter/app/core/windows/following.rb
162
+ - lib/flumtter/app/core/windows/list.rb
162
163
  - lib/flumtter/app/core/windows/mention.rb
163
164
  - lib/flumtter/app/core/windows/popup.rb
164
165
  - lib/flumtter/app/core/windows/tweet.rb
@@ -174,6 +175,7 @@ files:
174
175
  - lib/flumtter/app/plugins/commands/directmessage.rb
175
176
  - lib/flumtter/app/plugins/commands/directmessages.rb
176
177
  - lib/flumtter/app/plugins/commands/favorite.rb
178
+ - lib/flumtter/app/plugins/commands/list.rb
177
179
  - lib/flumtter/app/plugins/commands/mention.rb
178
180
  - lib/flumtter/app/plugins/commands/new_tweet.rb
179
181
  - lib/flumtter/app/plugins/commands/reply.rb