Sha256: 88c8f18a8c8be1bde15bf181fdb31949f122a5a1fc19bae5ce70b544a59e51f7

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

require 'thor'

module GoogleWebTranslate
  class CLI < Thor
    desc 'string from to', 'translate a string from one language to another'
    method_option :dt, type: :array, desc: 'data types'
    def translate(string, from, to)
      api_options = { debug: ENV['DEBUG'] }
      api_options[:dt] = options[:dt] if options[:dt]

      api = API.new(api_options)
      result = api.translate(string, from, to)
      p result.to_h
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_web_translate-0.1.0 lib/google_web_translate/cli.rb