11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/vantage/cli.rb', line 11
def run!
ARGV.options do |o|
urls = []
point = 'aws-us-east-1'
o.set_summary_indent(" ")
o.banner ="Usage: #{File.basename(__FILE__)} [OPTIONS]"
o.on('-u', '--urls URLS', Array, 'List of urls to check') { |list| urls = list }
o.on('-p', '--point POINT', String, 'Vantage point to check from. Default to aws-us-east-1.') { |p| point = p }
o.parse!
abort("Error: --urls is required\n\n#{o}") if urls.empty?
checks = urls.map { |u| { "url" => u } }
json = Vantage::Client.new.check("checks" => checks, "point" => point)
results = OkJson.decode(json)
results.each { |r| emit(r) }
end
end
|