5728a5608d7e802999266ff2387747e4957be938
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..32784d03b9eec6bd754068728ee117fd84d763e8
4--- /dev/null
5+++ b/plugins/frontend-search/README.md
6@@ -0,0 +1,82 @@
7+## Rationale ##
8+
9+The idea for this script is to help searches in important doc contents from frontend.
10+
11+## Instalation ##
12+
13+I will send a Pull Request with this plugin for .oh-my-zsh official repository. If accept them, it's only add in plugins list that exists in ```.zshrc``` file.
14+
15+For now, you can clone this repository and add in ```custom/plugins``` folder
16+
17+```bash
18+$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
19+```
20+
21+After this, restart your terminal and frontend-search plugin is configurated in you CLI.
22+
23+```bash
24+...
25+plugins=( <your-plugins-list>... frontend-search)
26+...
27+```
28+
29+## Commands ##
30+
31+All command searches are accept only in format
32+
33+* `frontend <search-content> <search-term>`
34+
35+The search content are
36+
37+* `jquery <api.jquery.com>`
38+* `mdn <developer.mozilla.org>`
39+* `compass <compass-style.org>`
40+* `html5please <html5please.com>`
41+* `caniuse <caniuse.com>`
42+* `aurajs <aurajs.com>`
43+* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
44+* `lodash <search>`
45+* `qunit <api.qunitjs.com>`
46+* `fontello <fontello.com>`
47+* `bootsnipp <bootsnipp.com>`
48+* `cssflow <cssflow.com>`
49+* `codepen <codepen.io>`
50+* `unheap <www.unheap.com>`
51+* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
52+* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
53+* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
54+* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
55+* `emberjs <emberjs.com>`
56+
57+
58+## Aliases ##
59+
60+There are a few aliases presented as well:
61+
62+* `jquery` A shorthand for `frontend jquery`
63+* `mdn` A shorthand for `frontend mdn`
64+* `compass` A shorthand for `frontend compass`
65+* `html5please` A shorthand for `frontend html5please`
66+* `caniuse` A shorthand for `frontend caniuse`
67+* `aurajs` A shorthand for `frontend aurajs`
68+* `dartlang` A shorthand for `frontend dartlang`
69+* `lodash` A shorthand for `frontend lodash`
70+* `qunit` A shorthand for `frontend qunit`
71+* `fontello` A shorthand for `frontend fontello`
72+* `bootsnipp` A shorthand for `frontend bootsnipp`
73+* `cssflow` A shorthand for `frontend cssflow`
74+* `codepen` A shorthand for `frontend codepen`
75+* `unheap` A shorthand for `frontend unheap`
76+* `bem` A shorthand for `frontend bem`
77+* `smacss` A shorthand for `frontend smacss`
78+* `angularjs` A shorthand for `frontend angularjs`
79+* `reactjs` A shorthand for `frontend reactjs`
80+* `emberjs` A shorthand for `frontend emberjs`
81+
82+## Author
83+
84+**Wilson Mendes (willmendesneto)**
85++ <https://twitter.com/willmendesneto>
86++ <http://github.com/willmendesneto>
87+
88+New features comming soon.
89diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
90new file mode 100644
91index 0000000000000000000000000000000000000000..38b1a80ea4394fe0abd9b3feef4128cbbf588aba
92--- /dev/null
93+++ b/plugins/frontend-search/frontend-search.plugin.zsh
94@@ -0,0 +1,151 @@
95+# frontend from terminal
96+
97+function frontend() {
98+
99+ # get the open command
100+ local open_cmd
101+ if [[ $(uname -s) == 'Darwin' ]]; then
102+ open_cmd='open'
103+ else
104+ open_cmd='xdg-open'
105+ fi
106+
107+ # no keyword provided, simply show how call methods
108+ if [[ $# -le 1 ]]; then
109+ echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
110+ return 1
111+ fi
112+
113+ # check whether the search engine is supported
114+ if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
115+ then
116+ echo "Search valid search content $1 not supported."
117+ echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
118+ echo "* jquery"
119+ echo "* mdn"
120+ echo "* compass"
121+ echo "* html5please"
122+ echo "* caniuse"
123+ echo "* aurajs"
124+ echo "* dartlang"
125+ echo "* lodash"
126+ echo "* qunit"
127+ echo "* fontello"
128+ echo "* bootsnipp"
129+ echo "* cssflow"
130+ echo "* codepen"
131+ echo "* unheap"
132+ echo "* bem"
133+ echo "* smacss"
134+ echo "* angularjs"
135+ echo "* reactjs"
136+ echo "* emberjs"
137+ echo ""
138+
139+ return 1
140+ fi
141+
142+ local url="http://"
143+ local query=""
144+
145+ case "$1" in
146+ "jquery")
147+ url="${url}api.jquery.com"
148+ url="${url}/?s=$2" ;;
149+ "mdn")
150+ url="${url}developer.mozilla.org"
151+ url="${url}/search?q=$2" ;;
152+ "compass")
153+ url="${url}compass-style.org"
154+ url="${url}/search?q=$2" ;;
155+ "html5please")
156+ url="${url}html5please.com"
157+ url="${url}/#$2" ;;
158+ "caniuse")
159+ url="${url}caniuse.com"
160+ url="${url}/#search=$2" ;;
161+ "aurajs")
162+ url="${url}aurajs.com"
163+ url="${url}/api/#stq=$2" ;;
164+ "dartlang")
165+ url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer"
166+ url="${url}/dart-$2" ;;
167+ "qunit")
168+ url="${url}api.qunitjs.com"
169+ url="${url}/?s=$2" ;;
170+ "fontello")
171+ url="${url}fontello.com"
172+ url="${url}/#search=$2" ;;
173+ "bootsnipp")
174+ url="${url}bootsnipp.com"
175+ url="${url}/search?q=$2" ;;
176+ "cssflow")
177+ url="${url}cssflow.com"
178+ url="${url}/search?q=$2" ;;
179+ "codepen")
180+ url="${url}codepen.io"
181+ url="${url}/search?q=$2" ;;
182+ "unheap")
183+ url="${url}www.unheap.com"
184+ url="${url}/?s=$2" ;;
185+ "bem")
186+ url="${url}google.com"
187+ url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;;
188+ "smacss")
189+ url="${url}google.com"
190+ url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;;
191+ "angularjs")
192+ url="${url}google.com"
193+ url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;;