Sha256: 2d85bf097d31fec11b924b71ccbac550bf29544f7ae9a902e96ffc891c4f9a42

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

#!/usr/bin/env ruby

require_relative '../lib/blade/translate/translate'

help = <<HELP
fy: Translate tools in the command line
  $ fy word
  $ fy world peace
  $ fy chinglish
  $ fy
  > enter the loop mode, ctrl+c to exit
HELP

if ARGV.empty?
  begin
    loop do
      print '> '
      input = gets.chomp
      # 输入为空时继续循环
      next if input == ''
      puts Blade::Translate.new(input).result
    end
  rescue Interrupt
    puts 'bye~'
  end
elsif %w{-h --help}.any? { |c| ARGV.include? c }
  puts help
else
  puts Blade::Translate.new(ARGV.join(' ')).result
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blade-translate-0.1.2 bin/thc
blade-translate-0.1.1 bin/thc.rb