Sha256: 8e714a1493b29317646a61c11ab16f5e490aa62842a2825f89e77fc3724db54e
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path('../lib', __dir__)) 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 "\t whoisrb ruby-lang.com" opts.separator "\t 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.empty? 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-6.0.0 | bin/whoisrb |
whois-5.1.1 | bin/whoisrb |