#!/bin/sh
# elvis: cablesearch	-- search for leaked diplomatic communications
# coder@kyleisom.net 20110105
. surfraw || exit 1

w3_config_hook () {
    # for when I figured out how to parse json in surfraw...
    def     SURFRAW_cablesearch_api     "http://cablegatesearch.net/cable/api/search"
    def     SURFRAW_cablesearch         "http://cablegatesearch.net/"
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
    Search leaked diplomatic cables.
Local options:
  If you can read this, it means your hard drive has already been wiped and
  the NSA alerted to your conniving schemes.
EOF
    w3_global_usage
}

w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments

escaped_args=`w3_url_of_arg $w3_args`

url="${SURFRAW_cablesearch}?q=${escaped_args}"
w3_browse_url $url
