Sha256: 0795cad35c4136ff7d8c6aa4f58aac356efc3a017f881e8cdb9aec9520ebf880

Contents?: true

Size: 953 Bytes

Versions: 10

Compression:

Stored size: 953 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_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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gman-4.7.1 bin/gman
gman-4.7.0 bin/gman
gman-4.6.5 bin/gman
gman-4.6.4 bin/gman
gman-4.6.3 bin/gman
gman-4.6.2 bin/gman
gman-4.6.1 bin/gman
gman-4.6.0 bin/gman
gman-4.5.1 bin/gman
gman-4.5.0 bin/gman