dialog_tui 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dialog_tui/version.rb +1 -1
- data/lib/dialog_tui.rb +19 -4
- 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: 0910fad969d36fb4dae62b0cc4eda1381c478f94
|
4
|
+
data.tar.gz: 0c94e240249f1ddccb6b4c294c7e09450594436b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a9eabc75a05bf3863ee1b83f4ac58e0e88cfdb4a5d3b8e93c77cab4eb4cc15b890c3a897b18df371a360695c66fcd3b451b97ea97200ebe60173301099c8d18
|
7
|
+
data.tar.gz: 32295a1394687422ba983c7ad664eeee7f0c8de1c8ade7320cf12035a115d7050fab2077e42de1a6b145d93139b2dd42888b851b0de614436b65f5b93c74ab31
|
data/lib/dialog_tui/version.rb
CHANGED
data/lib/dialog_tui.rb
CHANGED
@@ -75,6 +75,10 @@ module DialogTui
|
|
75
75
|
key.enter do
|
76
76
|
done = true
|
77
77
|
end
|
78
|
+
|
79
|
+
key.ctrl_c do
|
80
|
+
@ctrl_c.each(&:call) if @ctrl_c
|
81
|
+
end
|
78
82
|
}
|
79
83
|
end until done
|
80
84
|
|
@@ -90,6 +94,11 @@ module DialogTui
|
|
90
94
|
@options.push option
|
91
95
|
end
|
92
96
|
|
97
|
+
def ctrl_c &block
|
98
|
+
@ctrl_c ||= []
|
99
|
+
@ctrl_c << block
|
100
|
+
end
|
101
|
+
|
93
102
|
private
|
94
103
|
def print_options
|
95
104
|
puts '-'*10
|
@@ -162,6 +171,12 @@ if __FILE__ == $0
|
|
162
171
|
option '3. bye' do
|
163
172
|
puts '*waving*'
|
164
173
|
end
|
174
|
+
|
175
|
+
ctrl_c do
|
176
|
+
puts 'ctrl+c worked!'
|
177
|
+
exit 0
|
178
|
+
end
|
179
|
+
|
165
180
|
}.
|
166
181
|
tap { |result|
|
167
182
|
raise unless result.nil?
|
@@ -171,10 +186,10 @@ if __FILE__ == $0
|
|
171
186
|
end
|
172
187
|
end
|
173
188
|
|
174
|
-
puts
|
175
|
-
puts
|
176
|
-
puts '-----'
|
189
|
+
puts
|
190
|
+
puts ?_*10
|
177
191
|
puts 'manual testing here - use arrows and enter'
|
178
192
|
puts 'no way to fail it - just look at behavior'
|
179
|
-
|
193
|
+
puts 'ctrl+c when finished'
|
194
|
+
My.new.act
|
180
195
|
end
|