From cfe2263f4cf9775466dddc128e7502de582f18da Mon Sep 17 00:00:00 2001 From: div_bhasin Date: Sat, 4 May 2019 16:17:28 -0400 Subject: [PATCH 1/4] updated search URL for angular --- plugins/frontend-search/README.md | 2 +- plugins/frontend-search/frontend-search.plugin.zsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index f06e79102..d77a4210d 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -32,7 +32,7 @@ Available search contexts are: | context | URL | |---------------|--------------------------------------------------------------------------| -| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | +| angularjs | `https://angular.io/?search=` | | aurajs | `http://aurajs.com/api/#stq=` | | bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | | bootsnipp | `https://bootsnipp.com/search?q=` | diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 14877fb0d..fe57a43d7 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -26,7 +26,7 @@ function frontend() { # define search context URLS typeset -A urls urls=( - angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' + angularjs 'https://angular.io/?search=' aurajs 'http://aurajs.com/api/#stq=' bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' bootsnipp 'https://bootsnipp.com/search?q=' @@ -53,7 +53,7 @@ function frontend() { if [[ $# -lt 2 ]] then print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])" - print -P "" + print -P "sample" 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 "" From bcd41006259d88b9785e2cc7740d95545c6e07e3 Mon Sep 17 00:00:00 2001 From: div_bhasin Date: Sat, 4 May 2019 16:42:06 -0400 Subject: [PATCH 2/4] convert + to %20 encoding --- plugins/frontend-search/frontend-search.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index fe57a43d7..cad692ec4 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -53,7 +53,7 @@ function frontend() { if [[ $# -lt 2 ]] then print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])" - print -P "sample" + print -P "" 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 "" @@ -83,7 +83,7 @@ function frontend() { # build search url: # join arguments passed with '+', then append to search context URL # TODO substitute for proper urlencode method - url="${urls[$1]}${(j:+:)@[2,-1]}" + url="${urls[$1]}${(j:%20:)@[2,-1]}" echo "Opening $url ..." From b3498d110e4dca90f00ce325b4f48835b27ed5da Mon Sep 17 00:00:00 2001 From: div_bhasin Date: Sun, 5 May 2019 22:17:45 -0400 Subject: [PATCH 3/4] Extracted angularjs to its own context for users who still use Angular <= 2 --- plugins/frontend-search/README.md | 3 ++- plugins/frontend-search/_frontend-search.sh | 6 +++++- plugins/frontend-search/frontend-search.plugin.zsh | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index d77a4210d..24f82b262 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -32,7 +32,8 @@ Available search contexts are: | context | URL | |---------------|--------------------------------------------------------------------------| -| angularjs | `https://angular.io/?search=` | +| 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=` | | bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | | bootsnipp | `https://bootsnipp.com/search?q=` | diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh index 9aad76f76..573aa3aae 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend-search.sh @@ -33,7 +33,8 @@ function _frontend() { 'unheap: Search in unheap website' 'bem: Search in BEM 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' 'emberjs: Search in Ember website' 'stackoverflow: Search in StackOverflow website' @@ -99,6 +100,9 @@ function _frontend() { smacss) _describe -t points "Warp points" frontend_points && ret=0 ;; + angular) + _describe -t points "Warp points" frontend_points && ret=0 + ;; angularjs) _describe -t points "Warp points" frontend_points && ret=0 ;; diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index cad692ec4..c5f5ea7a9 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -26,7 +26,8 @@ function frontend() { # define search context URLS typeset -A urls urls=( - angularjs 'https://angular.io/?search=' + angular 'https://angular.io/?search=' + angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' aurajs 'http://aurajs.com/api/#stq=' bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' bootsnipp 'https://bootsnipp.com/search?q=' @@ -57,7 +58,7 @@ function frontend() { 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 "" - print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," + print -P " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," print -P " qunit, reactjs, smacss, stackoverflow, unheap" print -P "" @@ -73,7 +74,7 @@ function frontend() { echo "" echo "Valid contexts are:" echo "" - echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " + echo " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " echo " qunit, reactjs, smacss, stackoverflow, unheap" echo "" From 63b8d652f251f2b7e22ee80dbeaba8ecf6b9b535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 6 May 2019 19:09:51 +0200 Subject: [PATCH 4/4] Add small polishing touches --- .../frontend-search/frontend-search.plugin.zsh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index c5f5ea7a9..bef5992a3 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -1,3 +1,4 @@ +alias angular='frontend angular' alias angularjs='frontend angularjs' alias aurajs='frontend aurajs' alias bem='frontend bem' @@ -58,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 "and %Ucontext%u is one of the following:" print -P "" - print -P " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," - print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," - print -P " qunit, reactjs, smacss, stackoverflow, unheap" + print -P " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen," + print -P " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery," + print -P " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap" print -P "" print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." print -P "" @@ -74,15 +75,15 @@ function frontend() { echo "" echo "Valid contexts are:" echo "" - echo " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " - echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " - echo " qunit, reactjs, smacss, stackoverflow, unheap" + echo " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen," + echo " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery," + echo " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap" echo "" return 1 fi # 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 url="${urls[$1]}${(j:%20:)@[2,-1]}"