-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuji.rb
52 lines (42 loc) · 1.38 KB
/
uji.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
47
48
49
50
51
52
require 'optparse'
require_relative 'testcases'
# This hash will hold all of the options
# parsed from the command-line by
# OptionParser.
options = {}
optparse = OptionParser.new do|opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: optparse1.rb [options] file1 file2 ..."
# Define the options, and what they do
options[:verbose] = false
opts.on( '-v', '--verbose', 'Output more information' ) do
options[:verbose] = true
end
options[:config] = false
opts.on( '-c', '--config FILE', 'Use named config file. Default is uji.cfg.' ) do|config|
options[:config] = config
end
options[:logfile] = nil
opts.on( '-l', '--logfile FILE', 'Output results to logfile. Default is stdout.' ) do|file|
options[:logfile] = file
end
# This displays the help screen, all programs are
# assumed to have this option.
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
# Parse the command-line. Remember there are two forms
# of the parse method. The 'parse' method simply parses
# ARGV, while the 'parse!' method parses ARGV and removes
# any options found there, as well as any parameters for
# the options. What's left is the list of files to resize.
optparse.parse!
filename = options[:config]
unless filename
filename = "uji.cfg"
end
config = Testcases.new(filename, options[:verbose])
config.runtests