Sha256: 3f065fe3f8afe86e0ebd59e3c9c248e1d3be85e8d1a53b3a829a1d69ea296c0c
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' require 'Ip2l' optparse = OptionParser.new do |opts| opts.banner = "Reverse geocoding from ip address via an HTTP request." opts.separator "" opts.separator " Usage:" opts.separator " ip2l <IP>" opts.separator "" opts.separator " Example:" opts.separator " ip2l 2.22.61.217" opts.separator "" end begin options = optparse.parse! if options.count == 0 puts "Missing argument: IP" puts optparse exit elsif options.count > 1 puts "Too many arguments" puts optparse exit end ip = options[0] rescue OptionParser::InvalidOption, OptionParser::MissingArgument puts $!.to_s puts optparse exit end ip2l = Ip2l::Ip2l.new puts ip2l.ip_to_location(ip)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ip2l-0.1.0 | bin/ip2l |