Sha256: ddc2cb4699af7f9f143bcfc9bf5d484f3c322e7581417d2b7720727b604bd082

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require 'domain_check'
require 'date'
require 'optparse'

options        = { }
format_options = { }

opt_parser = OptionParser.new do |opts|
  opts.banner = "Usage: domain_check [options]"

  opts.separator ""
  opts.separator "Specific options:"

  opts.on("-d", "--domain DOMAIN", "Check the availability of DOMAIN") do |dom|
    options[:domain] = dom
  end

  opts.on("-f", "--file FILE",
          "Pass in a YAML configuration file at FILE") do |file|
    options[:file] = file
  end

  opts.on("-p", "--prefixes KW1,KW2,...",
          "Create domain names starting with each keyword and check them") do |prefixes|
    options[:prefixes] = prefixes.split(/,/)
  end

  opts.on("-s", "--suffixes KW1,KW2,...",
          "Create domain names ending with each keyword and check them") do |suffixes|
    options[:suffixes] = suffixes.split(/,/)
  end

  opts.on("-t", "--tlds TLD1,TLD2,...",
          "Create domain names with each of the TLDs and check them") do |tlds|
    options[:tlds] = tlds.split(/,/)
  end

  opts.on("-a", "--available-only", "Only show available domains") do |available|
    format_options[:available_only] = available
  end

  opts.on_tail("-?", "--help", "Show this message") do
    puts opts
    exit
  end
end

opt_parser.parse!(ARGV)

DomainCheck.new(**options).check do |result|
  formatter = DomainCheck::ConsoleFormatter.new(result, format_options[:available_only])
  formatter.format
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
domain_check-0.0.3 bin/domain_check