summaryrefslogtreecommitdiff
path: root/plugins/frontend-search/frontend-search.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/frontend-search/frontend-search.plugin.zsh')
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh19
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index f1d45b0d1..f7485621b 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -2,14 +2,6 @@
function frontend() {
- # get the open command
- local open_cmd
- if [[ $(uname -s) == 'Darwin' ]]; then
- open_cmd='open'
- else
- open_cmd='xdg-open'
- fi
-
# no keyword provided, simply show how call methods
if [[ $# -le 1 ]]; then
echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
@@ -17,7 +9,7 @@ function frontend() {
fi
# check whether the search engine is supported
- if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
+ if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
then
echo "Search valid search content $1 not supported."
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
@@ -40,6 +32,7 @@ function frontend() {
echo "* angularjs"
echo "* reactjs"
echo "* emberjs"
+ echo "* stackoverflow"
echo ""
return 1
@@ -103,13 +96,16 @@ function frontend() {
"emberjs")
url="${url}emberjs.com"
url="${url}/api/#stq=$2&stp=1" ;;
+ "stackoverflow")
+ url="${url}stackoverflow.com"
+ url="${url}/search?q=$2" ;;
*) echo "INVALID PARAM!"
return ;;
esac
echo "$url"
- $open_cmd "$url"
+ open_command "$url"
}
@@ -149,3 +145,6 @@ alias smacss='frontend smacss'
alias angularjs='frontend angularjs'
alias reactjs='frontend reactjs'
alias emberjs='frontend emberjs'
+
+# search websites
+alias stackoverflow='frontend stackoverflow'