Sha256: 1af455e27b177b5308036b9b5f4d104542339371ec0a19cfcbb1c369e28cdb1e

Contents?: true

Size: 947 Bytes

Versions: 4

Compression:

Stored size: 947 Bytes

Contents

#! /usr/bin/env ruby
# Given a domain-link string, returns information about the domain

require 'colorize'
require_relative "../lib/gman"

# Convenience method to simplify the command-line logic
class IsoCountryCodes
  class Code
    def to_s
      name
    end
  end
end

domain = ARGV[0]
String.disable_colorization = true if ARGV.last == "--no-color"

if domain.to_s.empty? || domain == "--no-color"
  puts "USAGE: gman <domain or email address> [--no-color]".red
  exit 1
end

gman = Gman.new(domain)

puts "Domain  : #{gman.domain}"

if gman.domain.nil?
  puts "Status  : " + "Invalid domain".red
  exit 1
end

if !gman.valid?
  puts "Status  : " + "Not a government domain".red
  exit 1
end

puts "Status  : " + "Valid government domain".green

["type", "country", "state", "city", "agency"].each do |key|
  value = gman.send(key)
  puts "#{key.capitalize.ljust(8)}: #{value}" if value
end

puts "SANCTIONED NATION".red if gman.sanctioned?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gman-5.0.3 bin/gman
gman-5.0.2 bin/gman
gman-5.0.1 bin/gman
gman-5.0.0 bin/gman