summaryrefslogtreecommitdiff
path: root/plugins/frontend-search
diff options
context:
space:
mode:
authorAndrew Janke <andrew@apjanke.net>2015-08-31 13:29:54 -0400
committerAndrew Janke <andrew@apjanke.net>2015-09-03 12:50:55 -0400
commit82c76f6b5c2718622a532fb759231e8d24171413 (patch)
treeb0126f6d9b3ed508c1a6d9b21df56e2523e0555f /plugins/frontend-search
parentfe92ea98e0633784508e85d6b756b1c3f667b2a4 (diff)
parentba5fd57c1ff4a8523715bab6acc35dbbeff88af7 (diff)
downloadzsh-82c76f6b5c2718622a532fb759231e8d24171413.tar.gz
zsh-82c76f6b5c2718622a532fb759231e8d24171413.tar.bz2
zsh-82c76f6b5c2718622a532fb759231e8d24171413.zip
Merge changes from #4241 into installer-portable-colors
Conflicts: tools/install.sh tools/upgrade.sh
Diffstat (limited to 'plugins/frontend-search')
-rw-r--r--plugins/frontend-search/README.md2
-rw-r--r--plugins/frontend-search/_frontend-search.sh4
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh17
3 files changed, 13 insertions, 10 deletions
diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
index 801d450f3..b8e96ea4a 100644
--- a/plugins/frontend-search/README.md
+++ b/plugins/frontend-search/README.md
@@ -43,6 +43,7 @@ The search content are
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
* `emberjs <emberjs.com>`
* `stackoverflow <stackoverflow.com>`
+* `npmjs <npmjs.com>`
## Aliases ##
@@ -69,6 +70,7 @@ There are a few aliases presented as well:
* `reactjs` A shorthand for `frontend reactjs`
* `emberjs` A shorthand for `frontend emberjs`
* `stackoverflow` A shorthand for `frontend stackoverflow`
+* `npmjs` A shorthand for `frontend npmjs`
## Author
diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh
index 252f21570..b12f829a1 100644
--- a/plugins/frontend-search/_frontend-search.sh
+++ b/plugins/frontend-search/_frontend-search.sh
@@ -37,6 +37,7 @@ function _frontend() {
'reactjs: Search in React website'
'emberjs: Search in Ember website'
'stackoverflow: Search in StackOverflow website'
+ 'npmjs: Search in NPMJS website'
)
_arguments -C \
@@ -110,6 +111,9 @@ function _frontend() {
stackoverflow)
_describe -t points "Warp points" frontend_points && ret=0
;;
+ npmjs)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
esac
;;
esac
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'