Add termit gem as a plugin.
This commit is contained in:
parent
e30a1243dc
commit
3d2fe72a01
2
plugins/termit/termit.plugin.zsh
Executable file
2
plugins/termit/termit.plugin.zsh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
alias translate=$ZSH/plugins/termit/termit.rb
|
37
plugins/termit/termit.rb
Executable file
37
plugins/termit/termit.rb
Executable 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user