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
Oh My Zsh
Commits
6da59ff0
Unverified
Commit
6da59ff0
authored
May 06, 2019
by
Marc Cornellà
Committed by
GitHub
May 06, 2019
Browse files
frontend-search: add Angular 2 context (#7830)
* Add search URL for angular 2 * Convert + to %20 encoding
parents
d4a3e064
63b8d652
Changes
3
Show whitespace changes
Inline
Side-by-side
plugins/frontend-search/README.md
View file @
6da59ff0
...
@@ -32,7 +32,8 @@ Available search contexts are:
...
@@ -32,7 +32,8 @@ Available search contexts are:
| context | URL |
| context | URL |
|---------------|--------------------------------------------------------------------------|
|---------------|--------------------------------------------------------------------------|
| angularjs |
`https://google.com/search?as_sitesearch=angularjs.org&as_q=`
|
| angular(>=2.0)|
`https://angular.io/?search=`
|
| angularjs(1.x)|
`https://google.com/search?as_sitesearch=angularjs.org&as_q=`
| aurajs |
`http://aurajs.com/api/#stq=`
|
| aurajs |
`http://aurajs.com/api/#stq=`
|
| bem |
`https://google.com/search?as_sitesearch=bem.info&as_q=`
|
| bem |
`https://google.com/search?as_sitesearch=bem.info&as_q=`
|
| bootsnipp |
`https://bootsnipp.com/search?q=`
|
| bootsnipp |
`https://bootsnipp.com/search?q=`
|
...
...
plugins/frontend-search/_frontend-search.sh
View file @
6da59ff0
...
@@ -33,7 +33,8 @@ function _frontend() {
...
@@ -33,7 +33,8 @@ function _frontend() {
'unheap: Search in unheap website'
'unheap: Search in unheap website'
'bem: Search in BEM website'
'bem: Search in BEM website'
'smacss: Search in SMACSS website'
'smacss: Search in SMACSS website'
'angularjs: Search in Angular website'
'angular: Search in Angular website for Angular 2.x'
'angularjs: Search in Angular website for Angular 1.x'
'reactjs: Search in React website'
'reactjs: Search in React website'
'emberjs: Search in Ember website'
'emberjs: Search in Ember website'
'stackoverflow: Search in StackOverflow website'
'stackoverflow: Search in StackOverflow website'
...
@@ -99,6 +100,9 @@ function _frontend() {
...
@@ -99,6 +100,9 @@ function _frontend() {
smacss
)
smacss
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
;;
angular
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
angularjs
)
angularjs
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
;;
...
...
plugins/frontend-search/frontend-search.plugin.zsh
View file @
6da59ff0
alias
angular
=
'frontend angular'
alias
angularjs
=
'frontend angularjs'
alias
angularjs
=
'frontend angularjs'
alias
aurajs
=
'frontend aurajs'
alias
aurajs
=
'frontend aurajs'
alias
bem
=
'frontend bem'
alias
bem
=
'frontend bem'
...
@@ -26,6 +27,7 @@ function frontend() {
...
@@ -26,6 +27,7 @@ function frontend() {
# define search context URLS
# define search context URLS
typeset
-A
urls
typeset
-A
urls
urls
=(
urls
=(
angular
'https://angular.io/?search='
angularjs
'https://google.com/search?as_sitesearch=angularjs.org&as_q='
angularjs
'https://google.com/search?as_sitesearch=angularjs.org&as_q='
aurajs
'http://aurajs.com/api/#stq='
aurajs
'http://aurajs.com/api/#stq='
bem
'https://google.com/search?as_sitesearch=bem.info&as_q='
bem
'https://google.com/search?as_sitesearch=bem.info&as_q='
...
@@ -57,9 +59,9 @@ function frontend() {
...
@@ -57,9 +59,9 @@ function frontend() {
print
-P
"%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print
-P
"%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print
-P
"and %Ucontext%u is one of the following:"
print
-P
"and %Ucontext%u is one of the following:"
print
-P
""
print
-P
""
print
-P
" angular
js
, aurajs, bem, bootsnipp, caniuse, codepen,
compassdoc, cssflow,
"
print
-P
" angular
(>= 2.0), angularjs (1.x)
, aurajs, bem, bootsnipp, caniuse, codepen,"
print
-P
" dartlang, emberjs, fontello, html5please, jquery,
lodash, mdn, npmjs,
"
print
-P
"
compassdoc, cssflow,
dartlang, emberjs, fontello, html5please, jquery,"
print
-P
" qunit, reactjs, smacss, stackoverflow, unheap"
print
-P
"
lodash, mdn, npmjs,
qunit, reactjs, smacss, stackoverflow, unheap"
print
-P
""
print
-P
""
print
-P
"For example: frontend npmjs mocha (or just: npmjs mocha)."
print
-P
"For example: frontend npmjs mocha (or just: npmjs mocha)."
print
-P
""
print
-P
""
...
@@ -73,17 +75,17 @@ function frontend() {
...
@@ -73,17 +75,17 @@ function frontend() {
echo
""
echo
""
echo
"Valid contexts are:"
echo
"Valid contexts are:"
echo
""
echo
""
echo
" angular
js
, aurajs, bem, bootsnipp, caniuse, codepen,
compassdoc, cssflow,
"
echo
" angular
(>= 2.0), angularjs (1.x)
, aurajs, bem, bootsnipp, caniuse, codepen,"
echo
" dartlang, emberjs, fontello, html5please, jquery,
lodash, mdn, npmjs,
"
echo
"
compassdoc, cssflow,
dartlang, emberjs, fontello, html5please, jquery,"
echo
" qunit, reactjs, smacss, stackoverflow, unheap"
echo
"
lodash, mdn, npmjs,
qunit, reactjs, smacss, stackoverflow, unheap"
echo
""
echo
""
return
1
return
1
fi
fi
# build search url:
# build search url:
# join arguments passed with '
+
', then append to search context URL
# join arguments passed with '
%20
', then append to search context URL
# TODO substitute for proper urlencode method
# TODO substitute for proper urlencode method
url
=
"
${
urls
[
$1
]
}${
(j
:
+
:
)@[2,-1]
}
"
url
=
"
${
urls
[
$1
]
}${
(j
:
%20
:
)@[2,-1]
}
"
echo
"Opening
$url
..."
echo
"Opening
$url
..."
...
...
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