require 'thor'

module Gif2lgtm
  class Cli < Thor
    SUPPORT_FORMARTS = ['GIF', 'PNG', 'JPEG', 'JPG'].freeze

    desc 'start ./foo.gif', 'Pass the file path.'
    def start(*images)
      # TODO: test
      images.each do |image|
        ext = File.extname(image).delete('.').upcase

        if SUPPORT_FORMARTS.include?(ext)
          Gif2lgtm::Main.start(image)
        else
          puts "extension: #{ext}"
          puts 'This extension is not allowed.'
          puts
        end
      end
    end
  end
end