Sha256: d7300f2d5ca79ff3b8a68982de8f8e28e1c769677f94b71205da1f7b0cba17c8

Contents?: true

Size: 1008 Bytes

Versions: 6

Compression:

Stored size: 1008 Bytes

Contents

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

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]

if ARGV.last == "--no-color"
  class String
    def red
      self
    end
    def green
      self
    end
  end
else
  require 'colored'
end

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

6 entries across 6 versions & 1 rubygems

Version Path
gman-5.0.9 bin/gman
gman-5.0.8 bin/gman
gman-5.0.7 bin/gman
gman-5.0.6 bin/gman
gman-5.0.5 bin/gman
gman-5.0.4 bin/gman