listpager 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/README.md +4 -1
- data/doc/netcat-example.gif +0 -0
- data/doc/screenshot.png +0 -0
- data/lib/listpager/client_terminal.rb +16 -7
- data/lib/listpager/list.rb +1 -1
- data/lib/listpager/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a76d00d0defcb6f0059184e756d5e6c7b1c68e0
|
4
|
+
data.tar.gz: 12a88ebbf65da53305230e555d156533b1608b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aacf79209dc13dd433bc76df5465062f9791766dcf7a15c12270f8236d6c8721f08d03dc1b7d1e70ae910baf0e115becba852e38896ac26ea9afe684d9015647
|
7
|
+
data.tar.gz: 02efcac4125245b0c0b8f2330af64e6ff50058aea957ac7e48858d12af9eec9c1bc05c8029e51c950e10007addd6bb1a166e6bf0f93935fe9674515500711ada
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,10 @@ interactive mode is a specially-crafted tmux session consisting of tools that
|
|
16
16
|
talk to each other. listpager is the node selection widget.
|
17
17
|
|
18
18
|
So basically, you may want to `popen` listpager, print a list of somethings to
|
19
|
-
its `stdin`, and listen on its `stdout`.
|
19
|
+
its `stdin`, and listen on its `stdout`. It'll go something like this:
|
20
|
+
|
21
|
+
![socat Listpager session](/doc/netcat-example.gif?raw=true "Controlling Listpager via TCP")
|
22
|
+
|
20
23
|
|
21
24
|
```ruby
|
22
25
|
listpager = IO.popen('listpager', 'r+')
|
Binary file
|
data/doc/screenshot.png
ADDED
Binary file
|
@@ -2,6 +2,7 @@ require 'ncursesw'
|
|
2
2
|
require 'shellwords'
|
3
3
|
require 'optparse'
|
4
4
|
require 'io/console'
|
5
|
+
require 'io/nonblock'
|
5
6
|
|
6
7
|
require 'listpager/color'
|
7
8
|
require 'listpager/list'
|
@@ -48,7 +49,7 @@ module Listpager
|
|
48
49
|
def connect_list
|
49
50
|
cterm = self
|
50
51
|
list.define_singleton_method :on_select_change do
|
51
|
-
cterm.cmd!('is
|
52
|
+
cterm.cmd!('selected-is', selected, selected_value, observe_lock: true)
|
52
53
|
end
|
53
54
|
|
54
55
|
list.define_singleton_method :on_key_press do |k|
|
@@ -104,6 +105,7 @@ module Listpager
|
|
104
105
|
list.values = []
|
105
106
|
list.selected = 0
|
106
107
|
list.dirty!
|
108
|
+
wake_up
|
107
109
|
|
108
110
|
when 'append'
|
109
111
|
list.values.push(args.fetch(0))
|
@@ -131,12 +133,22 @@ module Listpager
|
|
131
133
|
cmd! 'selected-is', list.selected, list.selected_value
|
132
134
|
when 'set-selected'
|
133
135
|
list.selected = args.fetch(0).to_i
|
134
|
-
cmd! 'seleted-is', list.selected, list.selected_value
|
135
136
|
|
136
137
|
when 'get-item'
|
137
138
|
cmd! 'item-is', args.fetch(0), list.values[args.fetch(0).to_i]
|
138
139
|
when 'set-item'
|
139
|
-
|
140
|
+
list.values[args.fetch(0).to_i] = args.fetch(1)
|
141
|
+
list.dirty!
|
142
|
+
cmd! 'item-is', args.fetch(0), list.values[args.fetch(0).to_i]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def wake_up
|
147
|
+
self_pipe[1].tap do |fd|
|
148
|
+
fd.nonblock do
|
149
|
+
fd.write('R')
|
150
|
+
fd.flush
|
151
|
+
end
|
140
152
|
end
|
141
153
|
end
|
142
154
|
|
@@ -226,10 +238,7 @@ module Listpager
|
|
226
238
|
|
227
239
|
def run
|
228
240
|
trap 'WINCH' do
|
229
|
-
|
230
|
-
fd.write 'R'
|
231
|
-
fd.flush
|
232
|
-
end
|
241
|
+
wake_up
|
233
242
|
end
|
234
243
|
|
235
244
|
begin
|
data/lib/listpager/list.rb
CHANGED
data/lib/listpager/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listpager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Owens
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- Rakefile
|
68
68
|
- bin/console
|
69
69
|
- bin/setup
|
70
|
+
- doc/netcat-example.gif
|
70
71
|
- doc/screenshot.png
|
71
72
|
- exe/listpager
|
72
73
|
- lib/listpager.rb
|