Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
b1d57fad
Commit
b1d57fad
authored
Aug 29, 2015
by
Robby Russell
Browse files
Merge pull request #4294 from willmendesneto/master
Frontend-search: add search in npm website
parents
192de6bc
0a808898
Changes
3
Hide whitespace changes
Inline
Side-by-side
plugins/frontend-search/README.md
View file @
b1d57fad
...
...
@@ -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
...
...
plugins/frontend-search/_frontend-search.sh
View file @
b1d57fad
...
...
@@ -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
...
...
plugins/frontend-search/frontend-search.plugin.zsh
View file @
b1d57fad
...
...
@@ -9,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>')"
...
...
@@ -33,6 +33,7 @@ function frontend() {
echo
"* reactjs"
echo
"* emberjs"
echo
"* stackoverflow"
echo
"* npmjs"
echo
""
return
1
...
...
@@ -99,6 +100,9 @@ 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
...
...
@@ -148,3 +152,4 @@ alias emberjs='frontend emberjs'
# search websites
alias
stackoverflow
=
'frontend stackoverflow'
alias
npmjs
=
'frontend npmjs'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment