Centurion / .config / surfraw / elvi / archwiki

#!/bin/bash
# elvis: archwiki	-- Search the Arch Linux Wiki (http://wiki.archlinux.org)
# Author: jason ryan • http://jasonwryan.com

. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_archwiki_language	"$SURFRAW_lang"
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search-string]
Description:
  Search the Arch Linux Wiki (wiki.archlinux.org)

Local options
 -language=ISOCODE | -l=ISOCODE  Two letter language code (resembles ISO country codes)
           en	|   Main Arch Wiki site (default)
           fr	|   French
           de	|   German
           he	|   Hebrew
           pl	|   Polish
           pt	|   Portugese
           ro	|   Romanian
           es	|   Spanish
           sv	|   Swedish
           uk	|   Ukranian

                    Default: en

EOF
    w3_global_usage
}

w3_parse_option_hook () {
    opt="$1"
    optarg="$2"
    case "$opt" in
	-language=*)  setopt  SURFRAW_archwiki_language	$optarg	;;
	-l=*)         setopt  SURFRAW_archwiki_language	$optarg	;;
	*) return 1 ;;
    esac
    return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains list of arguments

case "$SURFRAW_archwiki_language" in
    en) domain=".org"    ;;
    fr) domain=".fr"     ;;
    de) domain=".de"     ;;
    he) domain=".il"     ;;
    pl) domain=".pl"     ;;
    pt) domain="-br.org" ;;
    ro) domain=".ro"     ;;
    es) domain=".cl"     ;;
    sv) domain=".sv"     ;;
    uk) domain=".ua"     ;;
     *) domain=".org"    ;;
esac

# handle ssl
if [ $domain = ".org" -o $domain = ".de" ]; then
	protocol="https://";
  else	
	protocol="http://";
fi

if [ -z "$w3_args" ]; then
    w3_browse_url "${protocol}wiki.archlinux${domain}/"
  else
    escaped_args=$(w3_url_of_arg $w3_args)
    w3_browse_url "${protocol}wiki.archlinux${domain}/index.php?search=${escaped_args}"
fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.