Sha256: 7d074025196a09218e85ee0dd8ea06c5616f5529d48490bc400c80d9e27685ac

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

#!/usr/bin/env ruby -wU

require 'rubygems'
require 'thor'
require 'words_matrix'

module WordsMatrix
  class CLI < Thor
    desc 'search', 'Words search in a random letter matrix'
    option :n,               type: :numeric, desc: 'Size of letter grid. Optional, default is 10.'
    option :min_length,      type: :numeric, desc: 'Minimum word length. Optional, default is 3.'
    option :dictionary_path, type: :string,  desc: 'A path to dictionary with words, in case some external dictionary should be used. Internal dictionary is used by default.'

    def search

      service = WordsMatrix::Service.new(n: options["n"], min_length: options["min_length"], dict_path: options["dictionary_path"])
      puts "Letter grid created. Searching for words."

      service.find_words
      puts service
    rescue => e
      puts "Error while execution: #{e.message}"
    end
  end
end

WordsMatrix::CLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
words_matrix-0.0.1 bin/words_matrix