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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/webload/client/cli.rb', line 6
def self.parse(args)
options = OpenStruct.new
parser = OptionParser.new do |opts|
opts.banner = "Usage: webload [options]"
opts.on("-q", "--queue-name SQS_QUEUE_NAME", "The sqs queue name") do |v|
options.queue_name = v
end
opts.on("-l", "--log-file LOG_FILE", "The log file to be processed") do |v|
options.log_file = v
end
opts.on("-r", "--rate-per-minute RATE", "The number of requests per minute") do |v|
options.rpm = v.to_i
end
opts.on("-u", "--url URL", "The destination URL to send the traffic to") do |v|
options.url = v
end
opts.on("-b", "--batch NUM", "The number of requests to accumulate before sending to sqs") do |v|
options.batch = v.to_i
end
opts.on("-i", "--uri-ignore PATTERN", "a RUBY PATTERN to ignore") do |v|
options.uri_ignore = v
end
opts.on("-k", "--method-ignore PATTERN", "a RUBY PATTERN to ignore") do |v|
options.methods_ignore = v
end
opts.on("-m", "--multiply-by NUM", "Multiply the number of requests by a factor of") do |v|
options.multiply_by = v.to_i
end
opts.on("-a", "--basic-auth user:pass", "Basic Auth option") do |v|
options.basic_auth = v
end
opts.separator ""
opts.on_tail("-v", "--verbose", "Run verbosely") do |v|
options.verbose = v
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
options.rpm ||= 0
options.batch ||= 1
options.multiply_by ||= 1
parser.parse!(args)
options
end
|