From 3d2fe72a01bcbb6c7b271fbfb0ace8607dea5261 Mon Sep 17 00:00:00 2001
From: pawurb
Date: Tue, 5 Nov 2013 17:58:09 +0100
Subject: [PATCH] Add termit gem as a plugin.
---
plugins/termit/termit.plugin.zsh | 2 ++
plugins/termit/termit.rb | 37 ++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
create mode 100755 plugins/termit/termit.plugin.zsh
create mode 100755 plugins/termit/termit.rb
diff --git a/plugins/termit/termit.plugin.zsh b/plugins/termit/termit.plugin.zsh
new file mode 100755
index 00000000..4107603f
--- /dev/null
+++ b/plugins/termit/termit.plugin.zsh
@@ -0,0 +1,2 @@
+#!/bin/zsh
+alias translate=$ZSH/plugins/termit/termit.rb
diff --git a/plugins/termit/termit.rb b/plugins/termit/termit.rb
new file mode 100755
index 00000000..5d4dc31b
--- /dev/null
+++ b/plugins/termit/termit.rb
@@ -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
+