#!/usr/bin/env ruby # DuckGo is a RubyGem library and command line tool for searching with DuckDuckGo. # By default, it puts out only the relevant information, but when told, it will dump # all the data you could ask for. This tool aims to give access to most of the # features from the official API. # Daniel Ethridge require "duckgo" include DuckGo require "duckgo/version" # If there are no arguments... if ARGV.length == 0 puts "Hmm..." exit end help = """DuckGo lets you search duckduckgo.com for instant answers duckgo [--help | -h] : Display this help duckgo [--version | -V] : Display version duckgo something searchable : Auto-handle the search duckgo \!gem duckgo : Use !bang syntax to search a specific site View docs and API on https://github.com/wlib/duckgo Made by Daniel Ethridge | git.io/de """ # Argument "parser" if you want to call it that case ARGV[0] when "--help", "-h" puts help exit when "--version", "-V" puts "DuckGo v#{VERSION}" exit else handle(ARGV[0..-1].join(" ")) exit end