Sha256: 430a35451bfb9bf3a20b52d6be455103b80e021841d4703cc326e64358090ed7

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 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[1] == "--no-color"

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

gman = Gman.new(domain)

puts "Domain  : #{gman.domain}"

if gman.domain_parts.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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gman-4.4.1 bin/gman