Sha256: 02a33ee90632e95a4e3830724c713d882dd85a1f1f3c9a62e6c44447fe710926

Contents?: true

Size: 950 Bytes

Versions: 5

Compression:

Stored size: 950 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

unless gman.valid?
  puts 'Status  : ' + 'Not a government domain'.red
  exit 1
end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gman-7.0.2 bin/gman
gman-7.0.1 bin/gman
gman-7.0.0 bin/gman
gman-6.0.1 bin/gman
gman-6.0.0 bin/gman