mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
This commit is contained in:
commit
ebb67c81b8
4 changed files with 160 additions and 15 deletions
|
|
@ -12,7 +12,16 @@
|
||||||
__docker_containers() {
|
__docker_containers() {
|
||||||
declare -a cont_cmd
|
declare -a cont_cmd
|
||||||
cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
|
cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
|
||||||
_describe 'containers' cont_cmd
|
if [[ 'X$cont_cmd' != 'X' ]]
|
||||||
|
_describe 'containers' cont_cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
# Output a selectable list of all containers, even not running
|
||||||
|
__docker_all_containers() {
|
||||||
|
declare -a cont_cmd
|
||||||
|
cont_cmd=($(docker ps -a | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
|
||||||
|
if [[ 'X$cont_cmd' != 'X' ]]
|
||||||
|
_describe 'containers' cont_cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
# output a selectable list of all docker images
|
# output a selectable list of all docker images
|
||||||
|
|
@ -57,7 +66,7 @@ __diff() {
|
||||||
__docker_containers
|
__docker_containers
|
||||||
}
|
}
|
||||||
|
|
||||||
__events() {
|
__events() {
|
||||||
_arguments \
|
_arguments \
|
||||||
'--since=[Show previously created events and then stream.]'
|
'--since=[Show previously created events and then stream.]'
|
||||||
}
|
}
|
||||||
|
|
@ -98,10 +107,12 @@ __insert() {
|
||||||
|
|
||||||
__inspect() {
|
__inspect() {
|
||||||
__docker_images
|
__docker_images
|
||||||
__docker_containers
|
__docker_all_containers
|
||||||
}
|
}
|
||||||
|
|
||||||
__kill() {
|
__kill() {
|
||||||
|
_arguments \
|
||||||
|
'(-s,--signal=)'{-s,--signal=}'[KILL Signal]'
|
||||||
__docker_containers
|
__docker_containers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,7 +173,7 @@ __rm() {
|
||||||
'(-f,--force=)'{-f,--force=}'[Force removal of running container]' \
|
'(-f,--force=)'{-f,--force=}'[Force removal of running container]' \
|
||||||
'(-l,--link=)'{-l,--link=}'[Remove the specified link and not the underlying container]' \
|
'(-l,--link=)'{-l,--link=}'[Remove the specified link and not the underlying container]' \
|
||||||
'(-v,--volumes=)'{-v,--volumes=}'[Remove the volumes associated to the container]'
|
'(-v,--volumes=)'{-v,--volumes=}'[Remove the volumes associated to the container]'
|
||||||
__docker_containers
|
__docker_all_containers
|
||||||
}
|
}
|
||||||
|
|
||||||
__rmi() {
|
__rmi() {
|
||||||
|
|
@ -216,7 +227,7 @@ __start() {
|
||||||
_arguments \
|
_arguments \
|
||||||
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
|
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
|
||||||
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
|
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
|
||||||
__docker_containers
|
__docker_all_containers
|
||||||
}
|
}
|
||||||
|
|
||||||
__stats() {
|
__stats() {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
## Rationale ##
|
## Rationale ##
|
||||||
|
|
||||||
The idea for this script is to help searches in important doc contents from frontend.
|
> Searches for your Frontend contents more easier
|
||||||
|
|
||||||
|
|
||||||
## Instalation ##
|
## Instalation ##
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
For now, you can clone this repository and add in ```custom/plugins``` folder
|
Open your `.zshrc` file and load `frontend-search` plugin
|
||||||
|
|
||||||
```bash
|
|
||||||
$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
|
|
||||||
```
|
|
||||||
|
|
||||||
After this, restart your terminal and frontend-search plugin is configurated in you CLI.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
...
|
...
|
||||||
|
|
@ -20,6 +14,7 @@ plugins=( <your-plugins-list>... frontend-search)
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Commands ##
|
## Commands ##
|
||||||
|
|
||||||
All command searches are accept only in format
|
All command searches are accept only in format
|
||||||
|
|
@ -47,6 +42,7 @@ The search content are
|
||||||
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
|
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
|
||||||
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
|
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
|
||||||
* `emberjs <emberjs.com>`
|
* `emberjs <emberjs.com>`
|
||||||
|
* `stackoverflow <stackoverflow.com>`
|
||||||
|
|
||||||
|
|
||||||
## Aliases ##
|
## Aliases ##
|
||||||
|
|
@ -72,10 +68,13 @@ There are a few aliases presented as well:
|
||||||
* `angularjs` A shorthand for `frontend angularjs`
|
* `angularjs` A shorthand for `frontend angularjs`
|
||||||
* `reactjs` A shorthand for `frontend reactjs`
|
* `reactjs` A shorthand for `frontend reactjs`
|
||||||
* `emberjs` A shorthand for `frontend emberjs`
|
* `emberjs` A shorthand for `frontend emberjs`
|
||||||
|
* `stackoverflow` A shorthand for `frontend stackoverflow`
|
||||||
|
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
**Wilson Mendes (willmendesneto)**
|
**Wilson Mendes (willmendesneto)**
|
||||||
|
+ <https://plus.google.com/+WilsonMendes>
|
||||||
+ <https://twitter.com/willmendesneto>
|
+ <https://twitter.com/willmendesneto>
|
||||||
+ <http://github.com/willmendesneto>
|
+ <http://github.com/willmendesneto>
|
||||||
|
|
||||||
|
|
|
||||||
128
plugins/frontend-search/_frontend-search.sh
Normal file
128
plugins/frontend-search/_frontend-search.sh
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
#compdef frontend
|
||||||
|
|
||||||
|
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||||
|
zstyle ':completion::complete:frontend:*:commands' group-name commands
|
||||||
|
zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
|
||||||
|
zstyle ':completion::complete:frontend::' list-grouped
|
||||||
|
|
||||||
|
zmodload zsh/mapfile
|
||||||
|
|
||||||
|
function _frontend() {
|
||||||
|
local CONFIG=$HOME/.frontend-search
|
||||||
|
local ret=1
|
||||||
|
|
||||||
|
local -a commands
|
||||||
|
local -a frontend_points
|
||||||
|
|
||||||
|
frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
|
||||||
|
|
||||||
|
commands=(
|
||||||
|
'jquery: Search in jQuery website'
|
||||||
|
'mdn: Search in MDN website'
|
||||||
|
'compass: Search in COMPASS website'
|
||||||
|
'html5please: Search in HTML5 Please website'
|
||||||
|
'caniuse: Search in Can I Use website'
|
||||||
|
'aurajs: Search in AuraJs website'
|
||||||
|
'dartlang: Search in Dart website'
|
||||||
|
'lodash: Search in Lo-Dash website'
|
||||||
|
'qunit: Search in Qunit website'
|
||||||
|
'fontello: Search in fontello website'
|
||||||
|
'bootsnipp: Search in bootsnipp website'
|
||||||
|
'cssflow: Search in cssflow website'
|
||||||
|
'codepen: Search in codepen website'
|
||||||
|
'unheap: Search in unheap website'
|
||||||
|
'bem: Search in BEM website'
|
||||||
|
'smacss: Search in SMACSS website'
|
||||||
|
'angularjs: Search in Angular website'
|
||||||
|
'reactjs: Search in React website'
|
||||||
|
'emberjs: Search in Ember website'
|
||||||
|
'stackoverflow: Search in StackOverflow website'
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'1: :->first_arg' \
|
||||||
|
'2: :->second_arg' && ret=0
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
first_arg)
|
||||||
|
_describe -t frontend_points "Warp points" frontend_points && ret=0
|
||||||
|
_describe -t commands "Commands" commands && ret=0
|
||||||
|
;;
|
||||||
|
second_arg)
|
||||||
|
case $words[2] in
|
||||||
|
jquery)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
mdn)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
compass)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
html5please)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
caniuse)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
aurajs)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
dartlang)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
lodash)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
qunit)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
fontello)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
bootsnipp)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
cssflow)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
codepen)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
unheap)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
bem)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
smacss)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
angularjs)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
reactjs)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
emberjs)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
stackoverflow)
|
||||||
|
_describe -t points "Warp points" frontend_points && ret=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
_frontend "$@"
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: Shell-Script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# sh-basic-offset: 2
|
||||||
|
# End:
|
||||||
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
|
|
@ -17,7 +17,7 @@ function frontend() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check whether the search engine is supported
|
# check whether the search engine is supported
|
||||||
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
|
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
|
||||||
then
|
then
|
||||||
echo "Search valid search content $1 not supported."
|
echo "Search valid search content $1 not supported."
|
||||||
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
|
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
|
||||||
|
|
@ -40,6 +40,7 @@ function frontend() {
|
||||||
echo "* angularjs"
|
echo "* angularjs"
|
||||||
echo "* reactjs"
|
echo "* reactjs"
|
||||||
echo "* emberjs"
|
echo "* emberjs"
|
||||||
|
echo "* stackoverflow"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -103,6 +104,9 @@ function frontend() {
|
||||||
"emberjs")
|
"emberjs")
|
||||||
url="${url}emberjs.com"
|
url="${url}emberjs.com"
|
||||||
url="${url}/api/#stq=$2&stp=1" ;;
|
url="${url}/api/#stq=$2&stp=1" ;;
|
||||||
|
"stackoverflow")
|
||||||
|
url="${url}stackoverflow.com"
|
||||||
|
url="${url}/search?q=$2" ;;
|
||||||
*) echo "INVALID PARAM!"
|
*) echo "INVALID PARAM!"
|
||||||
return ;;
|
return ;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -149,3 +153,6 @@ alias smacss='frontend smacss'
|
||||||
alias angularjs='frontend angularjs'
|
alias angularjs='frontend angularjs'
|
||||||
alias reactjs='frontend reactjs'
|
alias reactjs='frontend reactjs'
|
||||||
alias emberjs='frontend emberjs'
|
alias emberjs='frontend emberjs'
|
||||||
|
|
||||||
|
# search websites
|
||||||
|
alias stackoverflow='frontend stackoverflow'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue