Sha256: 66564c4863dc60d361450c4df26b4dc0ffc0d60794d86e25f99766a3d05bdec7
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
#!/usr/bin/env ruby -wKU $:.unshift(File.expand_path("../../lib", __FILE__)) require 'optparse' require 'ostruct' require 'whois' options = OpenStruct.new OptionParser.new do |opts| opts.banner = "Whois: an intelligent pure Ruby Whois client" opts.define_head "Usage: ruby-whois [options] object" opts.separator "" opts.separator "Examples:" opts.separator " ruby-whois ruby-lang.com" opts.separator " ruby-whois 213.149.247.64" opts.separator "" opts.separator "Options:" opts.on("-t", "--timeout [SECONDS]", Integer, "specify the timeout value") do |seconds| options.timeout = seconds end opts.on_tail("--help", "Show this message") do puts opts exit end opts.on_tail("-v", "--version", "show version") do puts "#{Whois::NAME} #{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(:timeout => options.timeout) puts @client.query(object) rescue Whois::Error => e abort(e.message) rescue Timeout::Error => e abort("Request Timeout") end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whois-2.7.0 | bin/ruby-whois |
whois-2.6.4 | bin/ruby-whois |