Sha256: 128ef17679e2439fbf5c2bdf085d8003ba808e784e0b71d7cb31a9f819c24653
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby $:.unshift(File.expand_path("../../lib", __FILE__)) require 'optparse' require 'whois' options = {} OptionParser.new do |opts| opts.banner = "Whois: an intelligent pure Ruby WHOIS client" opts.define_head "Usage: whoisrb [options] object" opts.separator "" opts.separator "Examples:" opts.separator " whoisrb ruby-lang.com" opts.separator " whoisrb 213.149.247.64" opts.separator "" opts.separator "Options:" opts.on("-t", "--timeout [SECONDS]", Integer, "set the timeout") do |seconds| options[:timeout] = seconds end opts.on("-h", "--host [HOST]", String, "connect to server HOST") do |host| options[:host] = host end opts.on("--[no-]referral", "skip referral queries") do |boolean| options[:referral] = boolean end opts.on_tail("--help", "show this help and exit") do puts opts exit end opts.on_tail("--version", "output version information and exit") do puts "whoisrb #{Whois::VERSION}" exit end begin opts.parse! rescue OptionParser::ParseError puts opts exit 1 end if ARGV.size.zero? puts opts exit 1 end end object = ARGV.shift begin @client = Whois::Client.new(options) puts @client.lookup(object) rescue Whois::Error => e abort(e.message) rescue Timeout::Error abort("Request Timeout") end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whois-4.0.0.pre.beta2 | bin/whoisrb |
whois-4.0.0.pre.beta1 | bin/whoisrb |