summaryrefslogtreecommitdiff
path: root/plugins/frontend-search/frontend-search.plugin.zsh
diff options
context:
space:
mode:
authorAndrew Janke <andrew@apjanke.net>2015-09-03 13:05:24 -0400
committerAndrew Janke <andrew@apjanke.net>2015-09-03 13:05:24 -0400
commit93b4a6c02eeafb875de5d9bcccd73bdcd8265f40 (patch)
tree7cc87fcd416bf71cee77f30bf2e60cf607671f43 /plugins/frontend-search/frontend-search.plugin.zsh
parent689b5ab3c8c8bf30ee63cafb8401d7d95e41f359 (diff)
parent0532860c618aabc02d5dab34391b967e8e4c6272 (diff)
downloadzsh-93b4a6c02eeafb875de5d9bcccd73bdcd8265f40.tar.gz
zsh-93b4a6c02eeafb875de5d9bcccd73bdcd8265f40.tar.bz2
zsh-93b4a6c02eeafb875de5d9bcccd73bdcd8265f40.zip
Merge branch 'master' into osx-fix-tab-for-iterm
Conflicts: plugins/osx/osx.plugin.zsh
Diffstat (limited to 'plugins/frontend-search/frontend-search.plugin.zsh')
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index b9fb8634c..e47735a60 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|stackoverflow)' ]];
+ if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow|npmjs)' ]];
then
echo "Search valid search content $1 not supported."
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
@@ -41,6 +33,7 @@ function frontend() {
echo "* reactjs"
echo "* emberjs"
echo "* stackoverflow"
+ echo "* npmjs"
echo ""
return 1
@@ -107,13 +100,16 @@ function frontend() {
"stackoverflow")
url="${url}stackoverflow.com"
url="${url}/search?q=$2" ;;
+ "npmjs")
+ url="${url}www.npmjs.com"
+ url="${url}/search?q=$2" ;;
*) echo "INVALID PARAM!"
return ;;
esac
echo "$url"
- $open_cmd "$url"
+ open_command "$url"
}
@@ -156,3 +152,4 @@ alias emberjs='frontend emberjs'
# search websites
alias stackoverflow='frontend stackoverflow'
+alias npmjs='frontend npmjs'