Centurion / .config / surfraw / elvi / deli

#!/bin/sh
# elvis: deli		-- Search Delicious bookmarks
# Author: jason ryan • http://jasonwryan.com

. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_delicious_results $SURFRAW_results
def   SURFRAW_delicious_tags $SURFRAW_tags
def   SURFRAW_delicious_user $SURFRAW_user
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search-string]
Description: Search Delicious bookmarks (www.delicious.com)

Local options
 -tags=TAG  | -t=TAG            Refine your search with tags
                                [Separate multiple tags with "+"]

 -user=USER | -u=USER           Search a particular user's bookmarks

EOF
    w3_global_usage
}

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

# standard topic seach
if [ -z "$w3_args" ]; then
	w3_browse_url "http://www.delicious.com/search?p=${SURFRAW_delicious_results}"
else
	escaped_args=$(w3_url_of_arg $w3_args)

	# search for topic in a user's bookmarks
	if [ -n "${SURFRAW_delicious_user}" ]; then
	w3_browse_url "http://www.delicious.com/${SURFRAW_delicious_user}/${escaped_args}"

	# search for topic with tag(s)
	else
	w3_browse_url "http://www.delicious.com/tag/${escaped_args}"
	fi
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.