-
Notifications
You must be signed in to change notification settings - Fork 8
/
yesno.rb
executable file
·46 lines (37 loc) · 1.07 KB
/
yesno.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ruby
# [email protected] Apr-01-2014
require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join('/')
require 'pp'
class TestYesNo
ME = File.basename($0)
if ENV['CHANGE_TITLE']
if ME =~ /(.+)\.rb$/
base = $1
puts "\033]0;mrdialog - #{base}\007"
end
end
def initialize
end
def doit
text = <<EOF
Hi, this is a yes/no dialog box. You can use this to ask
questions that have an answer of either yes or no.
BTW, do you notice that long lines will be automatically
wrapped around so that they can fit in the box? You can
also control line breaking explicitly by inserting
"backslash n" at any place you like, but in this case,
auto wrap around will be disabled and you will have to
control line breaking yourself.
EOF
dialog = MRDialog.new
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
dialog.clear = true
dialog.title = "YES/NO BOX"
# dialog.ascii_lines = true
yesno = dialog.yesno(text,0, 0)
puts "yesno: #{yesno}"
end
end
if __FILE__ == $0
TestYesNo.new.doit
end