Sha256: d182d8b25db1241bf1091554f30e3aeadbc9ceaf58286b1767b4106c962278fe
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'bubblefish.rb' require 'unirest' class App include Methadone::Main include Methadone::CLILogging DEFAULT_TYPE = 'synonyms'.freeze main do |word| leak_exceptions(true) if ENV['DEBUG'] exit_now!('Missing MASHAPE_KEY') unless ENV['MASHAPE_KEY'] type = options['type'] || DEFAULT_TYPE url = "https://wordsapiv1.p.mashape.com/words/#{word}/#{type}" response = Unirest.get url, headers: { "X-Mashape-Key" => ENV['MASHAPE_KEY'], "Accept" => "application/json" } info (response.body[type] || response.body[type]['all'] || []).join("\n") end description "one line description of your app" on("--type VAL","Which type of word search to use, defaults to synonyms") arg :word, "Starting point for search" version Bubblefish::VERSION use_log_level_option :toggle_debug_on_signal => 'USR1' go! end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bubblefish-0.1.2 | bin/bubblefish |