cabb8f712a92060181a0505d26755aa17b273220

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #3814 from willmendesneto/frontend-search-add-autocomplete

Add autocomplete for frontend-search

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
  2index c1ccc909227456a0ff732ebe3a096b551b67fd2e..801d450f300db76af79370ce96f2ac9ef65ba024 100644
  3--- a/plugins/frontend-search/README.md
  4+++ b/plugins/frontend-search/README.md
  5@@ -1,18 +1,12 @@
  6 ## Rationale ##
  7 
  8-The idea for this script is to help searches in important doc contents from frontend.
  9+> Searches for your Frontend contents more easier
 10+
 11 
 12 ## Instalation ##
 13 
 14-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.
 15 
 16-For now, you can clone this repository and add in ```custom/plugins``` folder
 17-
 18-```bash
 19-$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
 20-```
 21-
 22-After this, restart your terminal and frontend-search plugin is configurated in you CLI.
 23+Open your `.zshrc` file and load `frontend-search` plugin
 24 
 25 ```bash
 26 ...
 27@@ -20,6 +14,7 @@ plugins=( <your-plugins-list>... frontend-search)
 28 ...
 29 ```
 30 
 31+
 32 ## Commands ##
 33 
 34 All command searches are accept only in format
 35@@ -75,9 +70,11 @@ There are a few aliases presented as well:
 36 * `emberjs` A shorthand for `frontend emberjs`
 37 * `stackoverflow` A shorthand for `frontend stackoverflow`
 38 
 39+
 40 ## Author
 41 
 42 **Wilson Mendes (willmendesneto)**
 43++ <https://plus.google.com/+WilsonMendes>
 44 + <https://twitter.com/willmendesneto>
 45 + <http://github.com/willmendesneto>
 46 
 47diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh
 48new file mode 100644
 49index 0000000000000000000000000000000000000000..252f215707240ce8c11236d919b601c51791be62
 50--- /dev/null
 51+++ b/plugins/frontend-search/_frontend-search.sh
 52@@ -0,0 +1,128 @@
 53+#compdef frontend
 54+
 55+zstyle ':completion:*:descriptions' format '%B%d%b'
 56+zstyle ':completion::complete:frontend:*:commands' group-name commands
 57+zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
 58+zstyle ':completion::complete:frontend::' list-grouped
 59+
 60+zmodload zsh/mapfile
 61+
 62+function _frontend() {
 63+  local CONFIG=$HOME/.frontend-search
 64+  local ret=1
 65+
 66+  local -a commands
 67+  local -a frontend_points
 68+
 69+  frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
 70+
 71+  commands=(
 72+    'jquery: Search in jQuery website'
 73+    'mdn: Search in MDN website'
 74+    'compass: Search in COMPASS website'
 75+    'html5please: Search in HTML5 Please website'
 76+    'caniuse: Search in Can I Use website'
 77+    'aurajs: Search in AuraJs website'
 78+    'dartlang: Search in Dart website'
 79+    'lodash: Search in Lo-Dash website'
 80+    'qunit: Search in Qunit website'
 81+    'fontello: Search in fontello website'
 82+    'bootsnipp: Search in bootsnipp website'
 83+    'cssflow: Search in cssflow website'
 84+    'codepen: Search in codepen website'
 85+    'unheap: Search in unheap website'
 86+    'bem: Search in BEM website'
 87+    'smacss: Search in SMACSS website'
 88+    'angularjs: Search in Angular website'
 89+    'reactjs: Search in React website'
 90+    'emberjs: Search in Ember website'
 91+    'stackoverflow: Search in StackOverflow website'
 92+  )
 93+
 94+  _arguments -C \
 95+    '1: :->first_arg' \
 96+    '2: :->second_arg' && ret=0
 97+
 98+  case $state in
 99+    first_arg)
100+      _describe -t frontend_points "Warp points" frontend_points && ret=0
101+      _describe -t commands "Commands" commands && ret=0
102+      ;;
103+    second_arg)
104+      case $words[2] in
105+        jquery)
106+          _describe -t points "Warp points" frontend_points && ret=0
107+          ;;
108+        mdn)
109+          _describe -t points "Warp points" frontend_points && ret=0
110+          ;;
111+        compass)
112+          _describe -t points "Warp points" frontend_points && ret=0
113+          ;;
114+        html5please)
115+          _describe -t points "Warp points" frontend_points && ret=0
116+          ;;
117+        caniuse)
118+          _describe -t points "Warp points" frontend_points && ret=0
119+          ;;
120+        aurajs)
121+          _describe -t points "Warp points" frontend_points && ret=0
122+          ;;
123+        dartlang)
124+          _describe -t points "Warp points" frontend_points && ret=0
125+          ;;
126+        lodash)
127+          _describe -t points "Warp points" frontend_points && ret=0
128+          ;;
129+        qunit)
130+          _describe -t points "Warp points" frontend_points && ret=0
131+          ;;
132+        fontello)
133+          _describe -t points "Warp points" frontend_points && ret=0
134+          ;;
135+        bootsnipp)
136+          _describe -t points "Warp points" frontend_points && ret=0
137+          ;;
138+        cssflow)
139+          _describe -t points "Warp points" frontend_points && ret=0
140+          ;;
141+        codepen)
142+          _describe -t points "Warp points" frontend_points && ret=0
143+          ;;
144+        unheap)
145+          _describe -t points "Warp points" frontend_points && ret=0
146+          ;;
147+        bem)
148+          _describe -t points "Warp points" frontend_points && ret=0
149+          ;;
150+        smacss)
151+          _describe -t points "Warp points" frontend_points && ret=0