-
Notifications
You must be signed in to change notification settings - Fork 4
/
ralf
executable file
·41 lines (35 loc) · 875 Bytes
/
ralf
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
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ralf'
require 'ralf/option_parser'
# Class to suppress writing of a particular string to an IO instance
class IOSuppress < IO
@expect_newline = false
@suppress = nil
def initialize(suppress, *args)
@suppress = suppress
super(*args)
end
# override write method to suppress string
def write(str)
case str
when "\n"
if @expect_newline
@expect_newline = false
return 1
end
when @suppress
@expect_newline = true
return @suppress.size
end
super(str)
end
end
$stderr = IOSuppress.new("warning: peer certificate won't be verified in this SSL session", $stderr.fileno, "w")
begin
if options = Ralf::OptionParser.parse(ARGV)
Ralf.run(options)
end
rescue => e
$stderr.puts "Error: #{e}"
end