663ac56d54d252b9de7c76346bd64a14340a51f7
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
2index 08930ddcda5ed2728b737e084c9d76b8863219a2..6eb1fed2b815a3d76306ffb8d325073f2d165891 100644
3--- a/plugins/frontend-search/frontend-search.plugin.zsh
4+++ b/plugins/frontend-search/frontend-search.plugin.zsh
5@@ -1,9 +1,7 @@
6-# frontend from terminal
7-
8 function frontend() {
9 emulate -L zsh
10
11- # define search content URLS
12+ # define search context URLS
13 typeset -A urls
14 urls=(
15 angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
16@@ -29,74 +27,45 @@ function frontend() {
17 unheap 'http://www.unheap.com/?s='
18 )
19
20- # show help for commands list
21- if [[ $1 =~ '(help|--help|-h)' ]]
22+ # show help for command list
23+ if [[ $# -lt 2 ]]
24 then
25- echo "Usage:"
26- echo "\n\tfrontend <search-content>\n\t<search-content>\n\tfrontend <search-content> <search-term>"
27- echo ""
28- echo "Where <search-content> is one of:"
29- echo "jquery, mdn, compass, html5please, caniuse, aurajs, dartlang, qunit, fontello,"
30- echo "bootsnipp, cssflow, codepen, unheap, bem, smacss, angularjs, reactjs, emberjs"
31- echo "help"
32- echo ""
33- echo "Where <search-term> is a term to search in allowed repositories"
34- echo ""
35- echo "frontend --help show plugin help"
36- echo "frontend -h show plugin help"
37- echo ""
38- echo "It is allowed to directly access all search contents."
39- echo ""
40+ print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
41+ print -P ""
42+ print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
43+ print -P "and %Ucontext%u is one of the following:"
44+ print -P ""
45+ print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
46+ print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
47+ print -P " qunit, reactjs, smacss, stackoverflow, unheap"
48+ print -P ""
49+ print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
50+ print -P ""
51 return 1
52 fi
53
54- # no keyword provided, simply show how call methods
55- if [[ $# -le 1 ]]
56- then
57- echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
58- return 1
59- fi
60-
61- # check whether the search engine is supported
62+ # check whether the search context is supported
63 if [[ -z "$urls[$1]" ]]
64 then
65- echo "Search valid search content $1 not supported."
66- echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
67- echo "* jquery"
68- echo "* mdn"
69- echo "* compass"
70- echo "* html5please"
71- echo "* caniuse"
72- echo "* aurajs"
73- echo "* dartlang"
74- echo "* lodash"
75- echo "* qunit"
76- echo "* fontello"
77- echo "* bootsnipp"
78- echo "* cssflow"
79- echo "* codepen"
80- echo "* unheap"
81- echo "* bem"
82- echo "* smacss"
83- echo "* angularjs"
84- echo "* reactjs"
85- echo "* emberjs"
86- echo "* stackoverflow"
87- echo "* npmjs"
88+ echo "Search context \"$1\" currently not supported."
89+ echo ""
90+ echo "Valid contexts are:"
91+ echo ""
92+ echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
93+ echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
94+ echo " qunit, reactjs, smacss, stackoverflow, unheap"
95 echo ""
96-
97 return 1
98 fi
99
100 # build search url:
101- # join arguments passed with '+', then append to search engine URL
102+ # join arguments passed with '+', then append to search context URL
103 # TODO substitute for proper urlencode method
104 url="${urls[$1]}${(j:+:)@[2,-1]}"