Commit 3de415e6521cb00efe238793a158c0dda148a748

Authored by mj
1 parent 9f5c61b703
Exists in master and in 2 other branches 02-merge, dev

Squashed 'repos/robbyrussell/oh-my-zsh/' changes from 75b9030..1400346

1400346 Merge pull request #3825 from kennedyoliveira/master
cabb8f7 Merge pull request #3814 from willmendesneto/frontend-search-add-autocomplete
2dbf995 Fixing some issues where show repeated weird values, and fixed commands that need the container autocomplete without being running, like start, now it autocompletes showing all the containers so you can start without knowing the right name
590d393 Add autocomplete for frontend-search
ff4663a Merge pull request #3802 from willmendesneto/patch-1
05f2ad3 fix stackoverflow url in search
b4729d3 Merge pull request #3792 from willmendesneto/frontend-search-add-new-repositories
eea77b7 Add stackoverflow link

git-subtree-dir: repos/robbyrussell/oh-my-zsh
git-subtree-split: 140034605edd0f72c548685d39e49687a44c1b23

Showing 4 changed files with 160 additions and 15 deletions Side-by-side Diff

plugins/docker/_docker
... ... @@ -12,7 +12,16 @@
12 12 __docker_containers() {
13 13 declare -a cont_cmd
14 14 cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
15   - _describe 'containers' cont_cmd
  15 + if [[ 'X$cont_cmd' != 'X' ]]
  16 + _describe 'containers' cont_cmd
  17 +}
  18 +
  19 +# Output a selectable list of all containers, even not running
  20 +__docker_all_containers() {
  21 + declare -a cont_cmd
  22 + cont_cmd=($(docker ps -a | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
  23 + if [[ 'X$cont_cmd' != 'X' ]]
  24 + _describe 'containers' cont_cmd
16 25 }
17 26  
18 27 # output a selectable list of all docker images
... ... @@ -57,7 +66,7 @@ __diff() {
57 66 __docker_containers
58 67 }
59 68  
60   -__events() {
  69 +__events() {
61 70 _arguments \
62 71 '--since=[Show previously created events and then stream.]'
63 72 }
... ... @@ -98,10 +107,12 @@ __insert() {
98 107  
99 108 __inspect() {
100 109 __docker_images
101   - __docker_containers
  110 + __docker_all_containers
102 111 }
103 112  
104 113 __kill() {
  114 + _arguments \
  115 + '(-s,--signal=)'{-s,--signal=}'[KILL Signal]'
105 116 __docker_containers
106 117 }
107 118  
... ... @@ -162,7 +173,7 @@ __rm() {
162 173 '(-f,--force=)'{-f,--force=}'[Force removal of running container]' \
163 174 '(-l,--link=)'{-l,--link=}'[Remove the specified link and not the underlying container]' \
164 175 '(-v,--volumes=)'{-v,--volumes=}'[Remove the volumes associated to the container]'
165   - __docker_containers
  176 + __docker_all_containers
166 177 }
167 178  
168 179 __rmi() {
... ... @@ -216,7 +227,7 @@ __start() {
216 227 _arguments \
217 228 '(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
218 229 '(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
219   - __docker_containers
  230 + __docker_all_containers
220 231 }
221 232  
222 233 __stats() {
plugins/frontend-search/README.md
1 1 ## Rationale ##
2 2  
3   -The idea for this script is to help searches in important doc contents from frontend.
  3 +> Searches for your Frontend contents more easier
  4 +
4 5  
5 6 ## Instalation ##
6 7  
7   -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.
8 8  
9   -For now, you can clone this repository and add in ```custom/plugins``` folder
10   -
11   -```bash
12   -$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
13   -```
14   -
15   -After this, restart your terminal and frontend-search plugin is configurated in you CLI.
  9 +Open your `.zshrc` file and load `frontend-search` plugin
16 10  
17 11 ```bash
18 12 ...
... ... @@ -20,6 +14,7 @@ plugins=( <your-plugins-list>... frontend-search)
20 14 ...
21 15 ```
22 16  
  17 +
23 18 ## Commands ##
24 19  
25 20 All command searches are accept only in format
... ... @@ -47,6 +42,7 @@ The search content are
47 42 * `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
48 43 * `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
49 44 * `emberjs <emberjs.com>`
  45 +* `stackoverflow <stackoverflow.com>`
50 46  
51 47  
52 48 ## Aliases ##
... ... @@ -72,10 +68,13 @@ There are a few aliases presented as well:
72 68 * `angularjs` A shorthand for `frontend angularjs`
73 69 * `reactjs` A shorthand for `frontend reactjs`
74 70 * `emberjs` A shorthand for `frontend emberjs`
  71 +* `stackoverflow` A shorthand for `frontend stackoverflow`
  72 +
75 73  
76 74 ## Author
77 75  
78 76 **Wilson Mendes (willmendesneto)**
  77 ++ <https://plus.google.com/+WilsonMendes>
79 78 + <https://twitter.com/willmendesneto>
80 79 + <http://github.com/willmendesneto>
81 80  
plugins/frontend-search/_frontend-search.sh
... ... @@ -0,0 +1,128 @@
  1 +#compdef frontend
  2 +
  3 +zstyle ':completion:*:descriptions' format '%B%d%b'
  4 +zstyle ':completion::complete:frontend:*:commands' group-name commands
  5 +zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
  6 +zstyle ':completion::complete:frontend::' list-grouped
  7 +
  8 +zmodload zsh/mapfile
  9 +
  10 +function _frontend() {
  11 + local CONFIG=$HOME/.frontend-search
  12 + local ret=1
  13 +
  14 + local -a commands
  15 + local -a frontend_points
  16 +
  17 + frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
  18 +
  19 + commands=(
  20 + 'jquery: Search in jQuery website'
  21 + 'mdn: Search in MDN website'
  22 + 'compass: Search in COMPASS website'
  23 + 'html5please: Search in HTML5 Please website'
  24 + 'caniuse: Search in Can I Use website'
  25 + 'aurajs: Search in AuraJs website'
  26 + 'dartlang: Search in Dart website'
  27 + 'lodash: Search in Lo-Dash website'
  28 + 'qunit: Search in Qunit website'
  29 + 'fontello: Search in fontello website'
  30 + 'bootsnipp: Search in bootsnipp website'
  31 + 'cssflow: Search in cssflow website'
  32 + 'codepen: Search in codepen website'
  33 + 'unheap: Search in unheap website'
  34 + 'bem: Search in BEM website'
  35 + 'smacss: Search in SMACSS website'
  36 + 'angularjs: Search in Angular website'
  37 + 'reactjs: Search in React website'
  38 + 'emberjs: Search in Ember website'
  39 + 'stackoverflow: Search in StackOverflow website'
  40 + )
  41 +
  42 + _arguments -C \
  43 + '1: :->first_arg' \
  44 + '2: :->second_arg' && ret=0
  45 +
  46 + case $state in
  47 + first_arg)
  48 + _describe -t frontend_points "Warp points" frontend_points && ret=0
  49 + _describe -t commands "Commands" commands && ret=0
  50 + ;;
  51 + second_arg)
  52 + case $words[2] in
  53 + jquery)
  54 + _describe -t points "Warp points" frontend_points && ret=0
  55 + ;;
  56 + mdn)
  57 + _describe -t points "Warp points" frontend_points && ret=0
  58 + ;;
  59 + compass)
  60 + _describe -t points "Warp points" frontend_points && ret=0
  61 + ;;
  62 + html5please)
  63 + _describe -t points "Warp points" frontend_points && ret=0
  64 + ;;
  65 + caniuse)
  66 + _describe -t points "Warp points" frontend_points && ret=0
  67 + ;;
  68 + aurajs)
  69 + _describe -t points "Warp points" frontend_points && ret=0
  70 + ;;
  71 + dartlang)
  72 + _describe -t points "Warp points" frontend_points && ret=0
  73 + ;;
  74 + lodash)
  75 + _describe -t points "Warp points" frontend_points && ret=0
  76 + ;;
  77 + qunit)
  78 + _describe -t points "Warp points" frontend_points && ret=0
  79 + ;;
  80 + fontello)
  81 + _describe -t points "Warp points" frontend_points && ret=0
  82 + ;;
  83 + bootsnipp)
  84 + _describe -t points "Warp points" frontend_points && ret=0
  85 + ;;
  86 + cssflow)
  87 + _describe -t points "Warp points" frontend_points && ret=0
  88 + ;;
  89 + codepen)
  90 + _describe -t points "Warp points" frontend_points && ret=0
  91 + ;;
  92 + unheap)
  93 + _describe -t points "Warp points" frontend_points && ret=0
  94 + ;;
  95 + bem)
  96 + _describe -t points "Warp points" frontend_points && ret=0
  97 + ;;
  98 + smacss)
  99 + _describe -t points "Warp points" frontend_points && ret=0
  100 + ;;
  101 + angularjs)
  102 + _describe -t points "Warp points" frontend_points && ret=0
  103 + ;;
  104 + reactjs)
  105 + _describe -t points "Warp points" frontend_points && ret=0
  106 + ;;
  107 + emberjs)
  108 + _describe -t points "Warp points" frontend_points && ret=0
  109 + ;;
  110 + stackoverflow)
  111 + _describe -t points "Warp points" frontend_points && ret=0
  112 + ;;
  113 + esac
  114 + ;;
  115 + esac
  116 +
  117 + return $ret
  118 +}
  119 +
  120 +_frontend "$@"
  121 +
  122 +# Local Variables:
  123 +# mode: Shell-Script
  124 +# sh-indentation: 2
  125 +# indent-tabs-mode: nil
  126 +# sh-basic-offset: 2
  127 +# End:
  128 +# vim: ft=zsh sw=2 ts=2 et
plugins/frontend-search/frontend-search.plugin.zsh
... ... @@ -17,7 +17,7 @@ function frontend() {
17 17 fi
18 18  
19 19 # check whether the search engine is supported
20   - if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
  20 + if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
21 21 then
22 22 echo "Search valid search content $1 not supported."
23 23 echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
... ... @@ -40,6 +40,7 @@ function frontend() {
40 40 echo "* angularjs"
41 41 echo "* reactjs"
42 42 echo "* emberjs"
  43 + echo "* stackoverflow"
43 44 echo ""
44 45  
45 46 return 1
... ... @@ -103,6 +104,9 @@ function frontend() {
103 104 "emberjs")
104 105 url="${url}emberjs.com"
105 106 url="${url}/api/#stq=$2&stp=1" ;;
  107 + "stackoverflow")
  108 + url="${url}stackoverflow.com"
  109 + url="${url}/search?q=$2" ;;
106 110 *) echo "INVALID PARAM!"
107 111 return ;;
108 112 esac
... ... @@ -149,3 +153,6 @@ alias smacss=&#39;frontend smacss&#39;
149 153 alias angularjs='frontend angularjs'
150 154 alias reactjs='frontend reactjs'
151 155 alias emberjs='frontend emberjs'
  156 +
  157 +# search websites
  158 +alias stackoverflow='frontend stackoverflow'