Adds web search script
This commit is contained in:
parent
f2417f5cb4
commit
2761db8ba5
1 changed files with 38 additions and 0 deletions
38
bin/.bin/search/websearch
Executable file
38
bin/.bin/search/websearch
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue