whatisinternet/sortable_answer

View on GitHub
bin/SortableAnswer

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require 'sortable_answer'

def main

  if ARGV[0].nil? || ARGV[1].nil?
    puts "ERROR:\n\n       You need to specify the files.\n\n\n      usage:\n SortableAnswer file1.txt file2.txt \n\n To output to file SortableAnswer file1.txt file2.txt |>file3.txt\n\n"
    exit(-1)
  else
    sortable = SortableAnswer::Answer.new("#{Dir.pwd}/#{ARGV[0].to_s}", "#{Dir.pwd}/#{ARGV[1].to_s}" )
    sortable.find_all_matches
    puts sortable.jsonfiy
  end

end

main