You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
5 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
declare search
|
||
|
declare method=w3m
|
||
|
|
||
|
case "$1" in
|
||
|
"ddg")
|
||
|
search="https://duckduckgo.co.uk/?q=%s"
|
||
|
# If the ddg command line client is installed, use it
|
||
|
type ddgr > /dev/null && method="ddgr"
|
||
|
shift
|
||
|
;;
|
||
|
"goog") search="https://google.com/search?q=%s" ; shift ;;
|
||
|
"aur") search="https://aur.archlinux.org/packages/?O=0&K=%s" ; shift ;;
|
||
|
"aw") search="https://wiki.archlinux.org/?search=%s" ; shift ;;
|
||
|
"wps") search="https://developer.wordpress.org/?s=%s" ; shift ;;
|
||
|
"wpf") search="https://developer.wordpress.org/?s=%s&post_type%5B%5D=wp-parser-function" ; shift ;;
|
||
|
"wph") search="https://developer.wordpress.org/?s=%s&post_type%5B%5D=wp-parser-hook" ; shift ;;
|
||
|
"wpc") search="https://developer.wordpress.org/?s=%s&post_type%5B%5D=wp-parser-class" ; shift ;;
|
||
|
"wpm") search="https://developer.wordpress.org/?s=%s&post_type%5B%5D=wp-parser-method" ; shift ;;
|
||
|
"phps") search="https://secure.php.net/manual-lookup.php?pattern=%s&scope=quickref" ; shift ;;
|
||
|
"ciu") search="https://caniuse.com/#search=%s" ; shift ;;
|
||
|
"mdn") search="https://developer.mozilla.org/en-US/search?q=%s" ; shift ;;
|
||
|
"gh") search="https://github.com/search?q=%s" ; shift ;;
|
||
|
"yt") search="https://www.youtube.com/results?search_query=%s" ; shift ;;
|
||
|
"wiki") search="https://en.wikipedia.org/wiki/%s" ; shift ;;
|
||
|
*)
|
||
|
search="https://duckduckgo.co.uk/?q=%s"
|
||
|
# If the ddg command line client is installed, use it
|
||
|
type ddgr > /dev/null && method="ddgr"
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
case "$method" in
|
||
|
"w3m") w3m $(printf "$search" $(echo "$@" | tr ' ' '+')) ;;
|
||
|
"ddgr") BROWSER=w3m ddgr "$@"
|
||
|
esac
|