-
-
Save dcadenas/123457 to your computer and use it in GitHub Desktop.
Script for searching spanish words on the RAE website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
require 'rubygems' | |
gem 'rest-client' | |
gem 'main' | |
gem 'highline' | |
require 'restclient' | |
require 'main' | |
require 'highline/import' | |
$terminal.wrap_at = 80 | |
$terminal.page_at = 22 | |
HighLine.track_eof = false | |
Main do | |
argument('word') do | |
description "Palabra a buscar" | |
end | |
def url | |
"http://buscon.rae.es/draeI/SrvltGUIBusUsual" | |
end | |
def elinks(word) | |
`curl -sd 'LEMA=#{word}' #{url}|elinks -dump -no-numbering -no-references` | |
end | |
def run | |
word = params['word'].value | |
say elinks(word) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment