#!/bin/sh
# elvis: nlab		-- Search the nLab Wiki (http://ncatlab.org)
# author: jason ryan • http://jasonwryan.com

. surfraw || exit 1

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [search terms]...
Description:
    Search the nLab Wiki (https://ncatlab.org)

    Local options:
    The nLab wiki search accepts regular expressions as search terms.

EOF
    w3_global_usage
}

w3_config
w3_parse_args "$@"

# w3_args now contains a list of arguments
if [ -z "$w3_args" ]; then
    w3_browse_url "https://ncatlab.org/"
else
    escaped_args=$(w3_url_of_arg $w3_args)
    w3_browse_url "https://ncatlab.org/nlab/search?&query=${escaped_args}"
fi
