Top Level Namespace
Defined Under Namespace
Modules: Kernel, Subversion
Classes: Array, IO, Object, String
Instance Method Summary
collapse
Instance Method Details
#confirm(question, options = ['Yes', 'No']) ⇒ Object
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/subwrap/svn_command.rb', line 134
def confirm(question, options = ['Yes', 'No'])
print question + " " +
"Yes".(:red) + ", " +
"No".(:green) +
" > "
response = ''
response = $stdin.getch.downcase while !['y', 'n', "\n"].include?(begin response.downcase!; response end)
response
end
|
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
|
# File 'lib/subwrap/pager.rb', line 3
def
return if PLATFORM =~ /win32/
return unless STDOUT.tty?
read, write = IO.pipe
unless Kernel.fork STDOUT.reopen(write)
STDERR.reopen(write) if STDERR.tty?
read.close
write.close
return
end
STDIN.reopen(read)
read.close
write.close
ENV['LESS'] = 'FSRX'
Kernel.select [STDIN] = ENV['PAGER'] || 'less'
exec rescue exec "/bin/sh", "-c",
end
|