Add termit gem as a plugin.

This commit is contained in:
pawurb 2013-11-05 17:58:09 +01:00
parent e30a1243dc
commit 3d2fe72a01
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,2 @@
#!/bin/zsh
alias translate=$ZSH/plugins/termit/termit.rb

37
plugins/termit/termit.rb Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env ruby
#
# termit
# Pawel Urbanek / @pawurb
#
# Termit is an easy way to use Google Translate in your terminal.
#
# Usage:
# termit 'source_language' 'target_language' 'text'
#
# Example:
# termit en fr 'hey cowboy where is your horse?'
# => 'hey cow-boy ou est votre cheval?'
#
# Options:
# -t - speech synthesis
# -s - synonyms list
#
# Check docs at: github.com/pawurb/termit
require 'rubygems'
begin
require 'termit'
rescue LoadError
puts "You need to install termit: gem install termit"
exit!(1)
end
begin
options = Termit::UserInputParser.new(ARGV).options
Termit::Main.new(options).translate
rescue Interrupt
STDERR.puts "\nTermit: exiting due to user request"
exit 130
end