def main(argv)
credentials = {
:host => "localhost",
:port => 8089,
:username => "admin",
:password => "changeme",
}
parser = OptionParser.new do |op|
op.on("--host HOSTNAME", String, "Set Splunk host (default: localhost)") do |s|
credentials[:host] = s
end
op.on("--port PORT", Integer, "Set Splunk port (default: 8089)") do |p|
credentials[:port] = p
end
op.on("--username USERNAME", String, "Set username for login (default: admin)") do |s|
credentials[:username] = s
end
op.on("--password PASSWORD", String, "Set password for login (default: changeme)") do |s|
credentials[:password] = s
end
end
parser.parse!(argv)
example_path = File.dirname(File.expand_path(__FILE__))
example_files = Dir.entries(example_path).
select() {|s| s.match('^\d_.+\.rb')}.
map() {|s| File.join(example_path, s)}
$LOAD_PATH.push(File.join(File.dirname(example_path), "lib"))
example_files.each do |p|
run_example(p, credentials)
end
end