Sha256: 7c50f491aa0187efed948b0fcf0cc8573d6016549e9293bd653d0325e1355d99

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

require 'thor'
require 'pp'

module GoogleWebTranslate
  # Command line interface
  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)
      pp result.to_h
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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