Unverified Commit 0232ac4b authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into master

parents afb02876 ebc700be
# Dirpersist plugin
This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file:
```zsh
plugins=(... dirpersist)
```
# Django plugin
This plugin adds completion and hints for the [Django Project](https://www.djangoproject.com/) `manage.py` commands
and options.
To use it, add `django` to the plugins array in your zshrc file:
```zsh
plugins=(... django)
```
## Usage
```zsh
$> python manage.py (press <TAB> here)
```
Would result in:
```zsh
cleanup -- remove old data from the database
compilemessages -- compile .po files to .mo for use with gettext
createcachetable -- creates table for SQL cache backend
createsuperuser -- create a superuser
dbshell -- run command-line client for the current database
diffsettings -- display differences between the current settings and Django defaults
dumpdata -- output contents of database as a fixture
flush -- execute 'sqlflush' on the current database
inspectdb -- output Django model module for tables in database
loaddata -- install the named fixture(s) in the database
makemessages -- pull out all strings marked for translation
reset -- executes 'sqlreset' for the given app(s)
runfcgi -- run this project as a fastcgi
runserver -- start a lightweight web server for development
...
```
If you want to see the options available for a specific command, try:
```zsh
$> python manage.py makemessages (press <TAB> here)
```
And that would result in:
```zsh
--all -a -- re-examine all code and templates
--domain -d -- domain of the message files (default: "django")
--extensions -e -- file extension(s) to examine (default: ".html")
--help -- display help information
--locale -l -- locale to process (default: all)
--pythonpath -- directory to add to the Python path
--settings -- python path to settings module
...
```
...@@ -154,7 +154,7 @@ _managepy-makemessages(){ ...@@ -154,7 +154,7 @@ _managepy-makemessages(){
"--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \ "--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \
"--no-wrap[Don't break long message lines into several lines.]" \ "--no-wrap[Don't break long message lines into several lines.]" \
"--no-location[Don't write '#: filename:line' lines.]" \ "--no-location[Don't write '#: filename:line' lines.]" \
'--no-obsolete[emove obsolete message strings.]' \ '--no-obsolete[Remove obsolete message strings.]' \
'--keep-pot[Keep .pot file after making messages.]' \ '--keep-pot[Keep .pot file after making messages.]' \
$nul_args && ret=0 $nul_args && ret=0
} }
......
File mode changed from 100755 to 100644
# Docker-compose plugin for oh my zsh # Docker-compose
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo. This plugin provides completion for [docker-compose](https://docs.docker.com/compose/) as well as some
aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file:
```
plugins=(... docker-compose)
```
## Aliases
| Alias | Command | Description |
|-----------|--------------------------|------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers |
| dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers |
| dcl | `docker-compose logs` | Show logs of container |
| dclf | `docker-compose logs -f` | Show logs and follow output |
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
...@@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() { ...@@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() {
local already_selected local already_selected
local -a services local -a services
already_selected=$(echo $words | tr " " "|") already_selected=$(echo $words | tr " " "|")
__docker-compose_q config --services \ __docker-compose_q ps --services "$@" \
| grep -Ev "^(${already_selected})$" | grep -Ev "^(${already_selected})$"
} }
...@@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() { ...@@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() {
__docker-compose_services_all() { __docker-compose_services_all() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
integer ret=1 integer ret=1
services=$(__docker-compose_all_services_in_compose_file) services=$(__docker-compose_all_services_in_compose_file "$@")
_alternative "args:services:($services)" && ret=0 _alternative "args:services:($services)" && ret=0
return ret return ret
} }
# All services that have an entry with the given key in their docker-compose.yml section
__docker-compose_services_with_key() {
local already_selected
local -a buildable
already_selected=$(echo $words | tr " " "|")
# flatten sections to one line, then filter lines containing the key and return section name.
__docker-compose_q config \
| sed -n -e '/^services:/,/^[^ ]/p' \
| sed -n 's/^ //p' \
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
| grep " \+$1:" \
| cut -d: -f1 \
| grep -Ev "^(${already_selected})$"
}
# All services that are defined by a Dockerfile reference # All services that are defined by a Dockerfile reference
__docker-compose_services_from_build() { __docker-compose_services_from_build() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
integer ret=1 __docker-compose_services_all --filter source=build
buildable=$(__docker-compose_services_with_key build)
_alternative "args:buildable services:($buildable)" && ret=0
return ret
} }
# All services that are defined by an image # All services that are defined by an image
__docker-compose_services_from_image() { __docker-compose_services_from_image() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
integer ret=1 __docker-compose_services_all --filter source=image
pullable=$(__docker-compose_services_with_key image)
_alternative "args:pullable services:($pullable)" && ret=0
return ret
}
__docker-compose_get_services() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local kind
declare -a running paused stopped lines args services
docker_status=$(docker ps > /dev/null 2>&1)
if [ $? -ne 0 ]; then
_message "Error! Docker is not running."
return 1
fi
kind=$1
shift
[[ $kind =~ (stopped|all) ]] && args=($args -a)
lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"})
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
declare -A begin end
while (( j < ${#header} - 1 )); do
i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
begin[${header[$i,$((j-1))]}]=$i
end[${header[$i,$((j-1))]}]=$k
done
lines=(${lines[2,-1]})
# Container ID
local line s name
local -a names
for line in $lines; do
if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
for name in $names; do
s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}"
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
stopped=($stopped $s)
else
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
paused=($paused $s)
fi
running=($running $s)
fi
done
fi
done
[[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
[[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
[[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
return ret
} }
__docker-compose_pausedservices() { __docker-compose_pausedservices() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
__docker-compose_get_services paused "$@" __docker-compose_services_all --filter status=paused
} }
__docker-compose_stoppedservices() { __docker-compose_stoppedservices() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
__docker-compose_get_services stopped "$@" __docker-compose_services_all --filter status=stopped
} }
__docker-compose_runningservices() { __docker-compose_runningservices() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
__docker-compose_get_services running "$@" __docker-compose_services_all --filter status=running
} }
__docker-compose_services() { __docker-compose_services() {
[[ $PREFIX = -* ]] && return 1 [[ $PREFIX = -* ]] && return 1
__docker-compose_get_services all "$@" __docker-compose_services_all
} }
__docker-compose_caching_policy() { __docker-compose_caching_policy() {
...@@ -196,9 +113,12 @@ __docker-compose_subcommand() { ...@@ -196,9 +113,12 @@ __docker-compose_subcommand() {
$opts_help \ $opts_help \
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \ "*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
'--force-rm[Always remove intermediate containers.]' \ '--force-rm[Always remove intermediate containers.]' \
'--memory[Memory limit for the build container.]' \ '(--quiet -q)'{--quiet,-q}'[Curb build output]' \
'(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \
'--no-cache[Do not use cache when building the image.]' \ '--no-cache[Do not use cache when building the image.]' \
'--pull[Always attempt to pull a newer version of the image.]' \ '--pull[Always attempt to pull a newer version of the image.]' \
'--compress[Compress the build context using gzip.]' \
'--parallel[Build images in parallel.]' \
'*:services:__docker-compose_services_from_build' && ret=0 '*:services:__docker-compose_services_from_build' && ret=0
;; ;;
(bundle) (bundle)
...@@ -213,7 +133,8 @@ __docker-compose_subcommand() { ...@@ -213,7 +133,8 @@ __docker-compose_subcommand() {
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
'--resolve-image-digests[Pin image tags to digests.]' \ '--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \ '--services[Print the service names, one per line.]' \
'--volumes[Print the volume names, one per line.]' && ret=0 '--volumes[Print the volume names, one per line.]' \
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
;; ;;
(create) (create)
_arguments \ _arguments \
...@@ -222,11 +143,12 @@ __docker-compose_subcommand() { ...@@ -222,11 +143,12 @@ __docker-compose_subcommand() {
$opts_no_recreate \ $opts_no_recreate \
$opts_no_build \ $opts_no_build \
"(--no-build)--build[Build images before creating containers.]" \ "(--no-build)--build[Build images before creating containers.]" \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services' && ret=0
;; ;;
(down) (down)
_arguments \ _arguments \
$opts_help \ $opts_help \
$opts_timeout \
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
$opts_remove_orphans && ret=0 $opts_remove_orphans && ret=0
...@@ -235,16 +157,18 @@ __docker-compose_subcommand() { ...@@ -235,16 +157,18 @@ __docker-compose_subcommand() {
_arguments \ _arguments \
$opts_help \ $opts_help \
'--json[Output events as a stream of json objects]' \ '--json[Output events as a stream of json objects]' \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services' && ret=0
;; ;;
(exec) (exec)
_arguments \ _arguments \
$opts_help \ $opts_help \
'-d[Detached mode: Run command in the background.]' \ '-d[Detached mode: Run command in the background.]' \
'--privileged[Give extended privileges to the process.]' \ '--privileged[Give extended privileges to the process.]' \
'(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
'*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
'(-):running services:__docker-compose_runningservices' \ '(-):running services:__docker-compose_runningservices' \
'(-):command: _command_names -e' \ '(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0 '*::arguments: _normal' && ret=0
...@@ -252,12 +176,12 @@ __docker-compose_subcommand() { ...@@ -252,12 +176,12 @@ __docker-compose_subcommand() {
(help) (help)
_arguments ':subcommand:__docker-compose_commands' && ret=0 _arguments ':subcommand:__docker-compose_commands' && ret=0
;; ;;
(images) (images)
_arguments \ _arguments \
$opts_help \ $opts_help \
'-q[Only display IDs]' \ '-q[Only display IDs]' \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services' && ret=0
;; ;;
(kill) (kill)
_arguments \ _arguments \
$opts_help \ $opts_help \
...@@ -271,7 +195,7 @@ __docker-compose_subcommand() { ...@@ -271,7 +195,7 @@ __docker-compose_subcommand() {
$opts_no_color \ $opts_no_color \
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services' && ret=0
;; ;;
(pause) (pause)
_arguments \ _arguments \
...@@ -290,12 +214,16 @@ __docker-compose_subcommand() { ...@@ -290,12 +214,16 @@ __docker-compose_subcommand() {
_arguments \ _arguments \
$opts_help \ $opts_help \
'-q[Only display IDs]' \ '-q[Only display IDs]' \
'*:services:__docker-compose_services_all' && ret=0 '--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \
'*:services:__docker-compose_services' && ret=0
;; ;;
(pull) (pull)
_arguments \ _arguments \
$opts_help \ $opts_help \
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
'--no-parallel[Disable parallel pulling]' \
'(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \
'--include-deps[Also pull services declared as dependencies]' \
'*:services:__docker-compose_services_from_image' && ret=0 '*:services:__docker-compose_services_from_image' && ret=0
;; ;;
(push) (push)
...@@ -317,6 +245,7 @@ __docker-compose_subcommand() { ...@@ -317,6 +245,7 @@ __docker-compose_subcommand() {
$opts_no_deps \ $opts_no_deps \
'-d[Detached mode: Run container in the background, print new container name.]' \ '-d[Detached mode: Run container in the background, print new container name.]' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
'*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'--name=[Assign a name to the container]:name: ' \ '--name=[Assign a name to the container]:name: ' \
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
...@@ -326,6 +255,7 @@ __docker-compose_subcommand() { ...@@ -326,6 +255,7 @@ __docker-compose_subcommand() {
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
'(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \ '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
"--use-aliases[Use the services network aliases in the network(s) the container connects to]" \
'(-):services:__docker-compose_services' \ '(-):services:__docker-compose_services' \
'(-):command: _command_names -e' \ '(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0 '*::arguments: _normal' && ret=0
...@@ -369,8 +299,10 @@ __docker-compose_subcommand() { ...@@ -369,8 +299,10 @@ __docker-compose_subcommand() {
"(--no-build)--build[Build images before starting containers.]" \ "(--no-build)--build[Build images before starting containers.]" \
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
'--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \
'--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \
$opts_remove_orphans \ $opts_remove_orphans \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services' && ret=0
;; ;;
(version) (version)
_arguments \ _arguments \
...@@ -409,8 +341,11 @@ _docker-compose() { ...@@ -409,8 +341,11 @@ _docker-compose() {
'(- :)'{-h,--help}'[Get help]' \ '(- :)'{-h,--help}'[Get help]' \
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
'--verbose[Show more output]' \ "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \
'(- :)'{-v,--version}'[Print version and exit]' \ '(- :)'{-v,--version}'[Print version and exit]' \
'--verbose[Show more output]' \
'--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \
'--no-ansi[Do not print ANSI control characters]' \
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
'--tls[Use TLS; implied by --tlsverify]' \ '--tls[Use TLS; implied by --tlsverify]' \
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \ '--tlscacert=[Trust certs signed only by this CA]:ca path:' \
...@@ -421,7 +356,7 @@ _docker-compose() { ...@@ -421,7 +356,7 @@ _docker-compose() {
'(-): :->command' \ '(-): :->command' \
'(-)*:: :->option-or-argument' && ret=0 '(-)*:: :->option-or-argument' && ret=0
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options
relevant_compose_flags=( relevant_compose_flags=(
"--file" "-f" "--file" "-f"
...@@ -435,6 +370,10 @@ _docker-compose() { ...@@ -435,6 +370,10 @@ _docker-compose() {
"--skip-hostname-check" "--skip-hostname-check"
) )
relevant_compose_repeatable_flags=(
"--file" "-f"
)
relevant_docker_flags=( relevant_docker_flags=(
"--host" "-H" "--host" "-H"
"--tls" "--tls"
...@@ -452,9 +391,18 @@ _docker-compose() { ...@@ -452,9 +391,18 @@ _docker-compose() {
fi fi
fi fi
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
compose_options+=$k if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then
if [[ -n "$opt_args[$k]" ]]; then values=("${(@s/:/)opt_args[$k]}")
compose_options+=$opt_args[$k] for value in $values
do
compose_options+=$k
compose_options+=$value
done
else
compose_options+=$k
if [[ -n "$opt_args[$k]" ]]; then
compose_options+=$opt_args[$k]
fi
fi fi
fi fi
done done
......
...@@ -18,6 +18,7 @@ alias dcrm='docker-compose rm' ...@@ -18,6 +18,7 @@ alias dcrm='docker-compose rm'
alias dcr='docker-compose run' alias dcr='docker-compose run'
alias dcstop='docker-compose stop' alias dcstop='docker-compose stop'
alias dcup='docker-compose up' alias dcup='docker-compose up'
alias dcupd='docker-compose up -d'
alias dcdn='docker-compose down' alias dcdn='docker-compose down'
alias dcl='docker-compose logs' alias dcl='docker-compose logs'
alias dclf='docker-compose logs -f' alias dclf='docker-compose logs -f'
......
#compdef docker-machine
# Description
# -----------
# zsh completion for docker-machine
# https://github.com/leonhartX/docker-machine-zsh-completion
# -------------------------------------------------------------------------
# Version
# -------
# 0.1.1
# -------------------------------------------------------------------------
# Authors
# -------
# * Ke Xu <leonhartx.k@gmail.com>
# -------------------------------------------------------------------------
# Inspiration
# -----------
# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
# * @ilkka _docker-machine
__docker-machine_get_hosts() {
[[ $PREFIX = -* ]] && return 1
local state
declare -a hosts
state=$1; shift
if [[ $state != all ]]; then
hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
else
hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
fi
_describe 'host' hosts "$@" && ret=0
return ret
}
__docker-machine_hosts_with_state() {
declare -a hosts
hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
_describe 'host' hosts
}
__docker-machine_hosts_all() {
__docker-machine_get_hosts all "$@"
}
__docker-machine_hosts_running() {
__docker-machine_get_hosts Running "$@"
}
__docker-machine_get_swarm() {
declare -a swarms
swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
_describe 'swarm' swarms
}
__docker-machine_hosts_and_files() {
_alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
}
__docker-machine_filters() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
(driver)
_describe -t driver-filter-opts "driver filter" opts_driver && ret=0
;;
(swarm)
__docker-machine_get_swarm && ret=0
;;
(state)
opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
_describe -t state-filter-opts "state filter" opts_state && ret=0
;;
(name)
__docker-machine_hosts_all && ret=0
;;
(label)
_message 'label' && ret=0
;;
*)
_message 'value' && ret=0
;;
esac
else
opts=('driver' 'swarm' 'state' 'name' 'label')
_describe -t filter-opts "filter" opts -qS "=" && ret=0
fi
return ret
}
__get_swarm_discovery() {
declare -a masters serivces
local service
services=()
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
for master in $masters; do
service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
services=($services $service)
done
_describe -t services "swarm service" services && ret=0
return ret
}
__get_create_argument() {
typeset -g docker_machine_driver
if [[ CURRENT -le 2 ]]; then
docker_machine_driver="none"
elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
docker_machine_driver=$words[CURRENT-1]
elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
docker_machine_driver=${${words[CURRENT-1]}/*=/}
fi
local driver_opt_cmd
local -a opts_provider opts_common opts_read_argument
opts_read_argument=(
": :->argument"
)
opts_common=(
$opts_help \
'(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
'--engine-install-url=[Custom URL to use for engine installation]:url' \
'*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
'*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
'*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
'*--engine-label=[Specify labels for the created engine]:label' \
'--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
'*--engine-env=[Specify environment variables to set in the engine]:environment' \
'--swarm[Configure Machine with Swarm]' \
'--swarm-image=[Specify Docker image to use for Swarm]:image' \
'--swarm-master[Configure Machine to be a Swarm master]' \
'--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
'--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
'*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
'*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
'--swarm-host=[ip/socket to listen on for Swarm master]:host' \
'--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
'--swarm-experimental[Enable Swarm experimental features]' \
'*--tls-san=[Support extra SANs for TLS certs]:option'
)
driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
if [[ $docker_machine_driver != "none" ]]; then
opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
_arguments \
$opts_provider \
$opts_read_argument \
$opts_common && ret=0
else
_arguments $opts_common && ret=0
fi
case $state in
(driver-option)
_describe -t driver-option "driver" opts_driver && ret=0
;;
(storage-driver-option)
_describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
;;
(swarm-service)
__get_swarm_discovery && ret=0
;;
(argument)
ret=0
;;
esac
return ret
}
__docker-machine_subcommand() {
local -a opts_help
opts_help=("(- :)--help[Print usage]")
local -a opts_only_host opts_driver opts_storage_driver opts_stragery
opts_only_host=(
"$opts_help"
"*:host:__docker-machine_hosts_all"
)
opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
integer ret=1
case "$words[1]" in
(active)
_arguments \
$opts_help \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
;;
(config)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
"*:host:__docker-machine_hosts_all" && ret=0
;;
(create)
__get_create_argument
;;
(env)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
'--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
'(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
'--no-proxy[Add machine IP to NO_PROXY environment variable]' \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(help)
_arguments ':subcommand:__docker-machine_commands' && ret=0
;;
(inspect)
_arguments \
$opts_help \
'(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(ip)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(kill)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(ls)
_arguments \
$opts_help \
'(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
'*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
'(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
case $state in
(filter-options)
__docker-machine_filters && ret=0
;;
esac
;;
(provision)
_arguments $opts_only_host && ret=0
;;
(regenerate-certs)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(restart)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(rm)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
'-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(scp)
_arguments \
$opts_help \
'(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
'*:files:__docker-machine_hosts_and_files' && ret=0
;;
(ssh)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(start)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(status)
_arguments $opts_only_host && ret=0
;;
(stop)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(upgrade)
_arguments $opts_only_host && ret=0
;;
(url)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
esac
return ret
}
__docker-machine_commands() {
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
fi
if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
&& ! _retrieve_cache docker_machine_subcommands;
then
local -a lines
lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
_docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
(( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
fi
_describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
}
__docker-machine_caching_policy() {
oldp=( "$1"(Nmh+1) )
(( $#oldp ))
}
_docker-machine() {
if [[ $service != docker-machine ]]; then
_call_function - _$service
return
fi
local curcontext="$curcontext" state line
integer ret=1
typeset -A opt_args
_arguments -C \
"(- :)"{-h,--help}"[Show help]" \
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
'(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
'--tls-ca-key[Private key to generate certificates]:file:_files' \
'--tls-client-cert[Client cert to use for TLS]:file:_files' \
'--tls-client-key[Private key used in client TLS auth]:file:_files' \
'--github-api-token[Token to use for requests to the Github API]' \
'--native-ssh[Use the native (Go-based) SSH implementation.]' \
'--bugsnag-api-token[BugSnag API token for crash reporting]' \
'(- :)'{-v,--version}'[Print the version]' \
"(-): :->command" \
"(-)*:: :->option-or-argument" && ret=0
case $state in
(command)
__docker-machine_commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
__docker-machine_subcommand && ret=0
ret=0
;;
esac
return ret
}
_docker-machine "$@"
...@@ -431,7 +431,7 @@ __docker_complete_events_filter() { ...@@ -431,7 +431,7 @@ __docker_complete_events_filter() {
integer ret=1 integer ret=1
declare -a opts declare -a opts
opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'type' 'volume') opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'scope' 'type' 'volume')
if compset -P '*='; then if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in case "${${words[-1]%=*}#*=}" in
...@@ -450,9 +450,9 @@ __docker_complete_events_filter() { ...@@ -450,9 +450,9 @@ __docker_complete_events_filter() {
;; ;;
(event) (event)
local -a event_opts local -a event_opts
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach'
'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' 'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize'
'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
_describe -t event-filter-opts "event filter options" event_opts && ret=0 _describe -t event-filter-opts "event filter options" event_opts && ret=0
;; ;;
(image) (image)
...@@ -461,6 +461,11 @@ __docker_complete_events_filter() { ...@@ -461,6 +461,11 @@ __docker_complete_events_filter() {
(network) (network)
__docker_complete_networks && ret=0 __docker_complete_networks && ret=0
;; ;;
(scope)
local -a scope_opts
scope_opts=('local' 'swarm')
_describe -t scope-filter-opts "scope filter options" scope_opts && ret=0
;;
(type) (type)
local -a type_opts local -a type_opts
type_opts=('container' 'daemon' 'image' 'network' 'volume') type_opts=('container' 'daemon' 'image' 'network' 'volume')
...@@ -612,6 +617,7 @@ __docker_container_subcommand() { ...@@ -612,6 +617,7 @@ __docker_container_subcommand() {
"($help)*--dns=[Custom DNS servers]:DNS server: " "($help)*--dns=[Custom DNS servers]:DNS server: "
"($help)*--dns-option=[Custom DNS options]:DNS option: " "($help)*--dns-option=[Custom DNS options]:DNS option: "
"($help)*--dns-search=[Custom DNS search domains]:DNS domains: " "($help)*--dns-search=[Custom DNS search domains]:DNS domains: "
"($help)*--domainname=[Container NIS domain name]:domainname:_hosts"
"($help)*"{-e=,--env=}"[Environment variables]:environment variable: " "($help)*"{-e=,--env=}"[Environment variables]:environment variable: "
"($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: "
"($help)*--env-file=[Read environment variables from a file]:environment file:_files" "($help)*--env-file=[Read environment variables from a file]:environment file:_files"
...@@ -889,7 +895,7 @@ __docker_container_subcommand() { ...@@ -889,7 +895,7 @@ __docker_container_subcommand() {
$opts_help \ $opts_help \
$opts_attach_exec_run_start \ $opts_attach_exec_run_start \
"($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \
"($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ "($help -i --interactive)"{-i,--interactive}"[Attach container's stdin]" \
"($help -)*:containers:__docker_complete_stopped_containers" && ret=0 "($help -)*:containers:__docker_complete_stopped_containers" && ret=0
;; ;;
(stats) (stats)
...@@ -923,7 +929,7 @@ __docker_container_subcommand() { ...@@ -923,7 +929,7 @@ __docker_container_subcommand() {
local state local state
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
opts_create_run_update \ $opts_create_run_update \
"($help -)*: :->values" && ret=0 "($help -)*: :->values" && ret=0
case $state in case $state in
(values) (values)
...@@ -2209,7 +2215,7 @@ __docker_stack_subcommand() { ...@@ -2209,7 +2215,7 @@ __docker_stack_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0 "($help -):stack:__docker_complete_stacks" && ret=0
;; ;;
...@@ -2280,6 +2286,9 @@ __docker_swarm_subcommand() { ...@@ -2280,6 +2286,9 @@ __docker_swarm_subcommand() {
$opts_help \ $opts_help \
"($help)--advertise-addr=[Advertised address]:ip\:port: " \ "($help)--advertise-addr=[Advertised address]:ip\:port: " \
"($help)--data-path-addr=[Data path IP or interface]:ip " \ "($help)--data-path-addr=[Data path IP or interface]:ip " \
"($help)--data-path-port=[Data Path Port]:port " \
"($help)--default-addr-pool=[Default address pool]" \
"($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \
"($help)--autolock[Enable manager autolocking]" \ "($help)--autolock[Enable manager autolocking]" \
"($help)--availability=[Availability of the node]:availability:(active drain pause)" \ "($help)--availability=[Availability of the node]:availability:(active drain pause)" \
"($help)--cert-expiry=[Validity period for node certificates]:duration: " \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \
...@@ -3024,4 +3033,4 @@ _docker "$@" ...@@ -3024,4 +3033,4 @@ _docker "$@"
# indent-tabs-mode: nil # indent-tabs-mode: nil
# sh-basic-offset: 4 # sh-basic-offset: 4
# End: # End:
# vim: ft=zsh sw=4 ts=4 et # vim: ft=zsh sw=4 ts=4 et
\ No newline at end of file
# Doctl
This plugin provides completion for [Doctl](https://github.com/digitalocean/doctl).
To use it add doctl to the plugins array in your zshrc file.
```bash
plugins=(... doctl)
```
# Autocompletion for doctl, the command line tool for DigitalOcean service
#
# doctl project: https://github.com/digitalocean/doctl
#
# Author: https://github.com/HalisCz
if [ $commands[doctl] ]; then
source <(doctl completion zsh)
fi
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. Automatically load your project ENV variables from `.env` file when you `cd` into project root directory.
Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environmentssuch as resource handles for databases or credentials for external servicesshould be extracted from the code into environment variables. Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
## Installation ## Installation
Just add the plugin to your `.zshrc`: Just add the plugin to your `.zshrc`:
```sh ```sh
plugins=(git man dotenv) plugins=(... dotenv)
``` ```
## Usage ## Usage
Create `.env` file inside your project directory and put your local ENV variables there. Create `.env` file inside your project root directory and put your ENV variables there.
For example: For example:
```sh ```sh
...@@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f ...@@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017 MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001 PORT=3001
``` ```
You can even mix both formats, although it's probably a bad idea.
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only. ## Version Control
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
## Disclaimer
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
If you need more advanced and feature-rich ENV management, check out these awesome projects:
* [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)
#!/bin/zsh
source_env() { source_env() {
if [[ -f .env ]]; then if [[ -f .env ]]; then
source .env # test .env syntax
zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
if [[ -o a ]]; then
source .env
else
set -a
source .env
set +a
fi
fi fi
} }
autoload -U add-zsh-hook autoload -U add-zsh-hook
add-zsh-hook chpwd source_env add-zsh-hook chpwd source_env
source_env
...@@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl) ...@@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl)
- Upload a file: `droplr ./path/to/file/` - Upload a file: `droplr ./path/to/file/`
- Shorten a link: `droplr http://example.com` - Shorten a link: `droplr https://example.com`
# Drush
## Description
This plugin offers aliases and functions to make the work with drush easier and more productive.
To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
```
plugins=(... drush)
```
## Aliases
| Alias | Description | Command |
|-------|-----------------------------------------------------------------------|-----------------------------|
| dr | Display drush help | drush |
| drca | Clear all drupal caches. | drush cc all |
| drcb | Clear block cache. | drush cc block |
| drcg | Clear registry cache. | drush cc registry |
| drcj | Clear css-js cache. | drush cc css-js |
| drcm | Clear menu cache. | drush cc menu |
| drcml | Clear module-list cache. | drush cc module-list |
| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
| drct | Clear theme-registry cache. | drush cc theme-registry |
| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
| drf | Display features status | drush features |
| drfr | Revert a feature module on your site. | drush features-revert -y |
| drfu | Update a feature module on your site. | drush features-update -y |
| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
| drif | Flush all derived images. | drush image-flush --all |
| drpm | Show a list of available modules. | drush pm-list --type=module |
| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
| drup | Apply any database updates required (as with running update.php). | drush updatedb |
| drups | List any pending database updates. | drush updatedb-status |
| drv | Show drush version. | drush version |
| drvd | Delete a variable. | drush variable-del |
| drvg | Get a list of some or all site variables and values. | drush variable-get |
| drvs | Set a variable. | drush variable-set |
## Functions
### dren
Download and enable one or more extensions (modules or themes).
Must be invoked with one or more parameters. e.g.:
`dren devel` or `dren devel module_filter views`
### drf
Edit drushrc, site alias, and Drupal settings.php files.
Can be invoked with one or without parameters. e.g.:
`drf 1`
### dris
Disable one or more extensions (modules or themes)
Must be invoked with one or more parameters. e.g.:
`dris devel` or `dris devel module_filter views`
### drpu
Uninstall one or more modules.
Must be invoked with one or more parameters. e.g.:
`drpu devel` or `drpu devel module_filter views`
### drnew
Creates a brand new drupal website.
Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
```
Installation complete. User name: admin User password: cf7t8yqNEm
```
## Additional features
### Autocomplete
The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin.
So, it is possible to type a command:
```
drush sql
```
And as soon as the tab key is pressed, the script will display the available commands:
```
drush sql
sqlc sql-conf sql-create sql-dump sql-query sql-sanitize
sql-cli sql-connect sql-drop sqlq sqlsan sql-sync
```
# BASH completion script for Drush.
#
# Place this in your /etc/bash_completion.d/ directory or source it from your
# ~/.bash_completion or ~/.bash_profile files. Alternatively, source
# examples/example.bashrc instead, as it will automatically find and source
# this file.
#
# If you're using ZSH instead of BASH, add the following to your ~/.zshrc file
# and source it.
#
# autoload bashcompinit
# bashcompinit
# source /path/to/your/drush.complete.sh
# Ensure drush is available.
which drush > /dev/null || alias drush &> /dev/null || return
__drush_ps1() {
f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$"
if [ -f $f ]
then
__DRUPAL_SITE=$(cat "$f")
else
__DRUPAL_SITE="$DRUPAL_SITE"
fi
# Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a
# __drush_ps1_colorize_alias() function for color hints in your Drush PS1
# prompt. See example.prompt.sh for an example implementation.
if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then
__drush_ps1_colorize_alias
fi
[[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE"
}
# Completion function, uses the "drush complete" command to retrieve
# completions for a specific command line COMP_WORDS.
_drush_completion() {
# Set IFS to newline (locally), since we only use newline separators, and
# need to retain spaces (or not) after completions.
local IFS=$'\n'
# The '< /dev/null' is a work around for a bug in php libedit stdin handling.
# Note that libedit in place of libreadline in some distributions. See:
# https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214
COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) )
}
# Register our completion function. We include common short aliases for Drush.
complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush7 drush8 drush.php
# Drush support.
function dren() {
drush en $@ -y
}
function dris() {
drush pm-disable $@ -y
}
function drpu() {
drush pm-uninstall $@ -y
}
function drf() {
if [[ $1 == "" ]] then
drush core-config
else
drush core-config --choice=$1
fi
}
function drfi() {
if [[ $1 == "fields" ]]; then
drush field-info fields
elif [[ $1 == "types" ]]; then
drush field-info types
else
drush field-info
fi
}
function drnew() {
cd ~
echo "Website's name: "
read WEBSITE_NAME
HOST=http://$(hostname -i)/
if [[ $WEBSITE_NAME == "" ]] then
MINUTES=$(date +%M:%S)
WEBSITE_NAME="Drupal-$MINUTES"
echo "Your website will be named: $WEBSITE_NAME"
fi
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
echo "Type your localhost directory: (Leave empty for /var/www/html/)"
read DIRECTORY
if [[ $DIRECTORY == "" ]] then
DIRECTORY="/var/www/html/"
fi
echo "Moving to $DIRECTORY$WEBSITE_NAME"
sudo mv $WEBSITE_NAME $DIRECTORY
cd $DIRECTORY$WEBSITE_NAME
echo "Database's user: "
read DATABASE_USR
echo "Database's password: "
read -s DATABASE_PWD
echo "Database's name for your project: "
read DATABASE
DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
open_command $HOST$WEBSITE_NAME
echo "Done"
}
# Aliases, sorted alphabetically.
alias dr="drush"
alias drca="drush cc all" # Deprecated for Drush 8
alias drcb="drush cc block" # Deprecated for Drush 8
alias drcg="drush cc registry" # Deprecated for Drush 8
alias drcj="drush cc css-js"
alias drcm="drush cc menu"
alias drcml="drush cc module-list"
alias drcr="drush core-cron"
alias drct="drush cc theme-registry"
alias drcv="drush cc views"
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
alias drf="drush features"
alias drfr="drush features-revert -y"
alias drfu="drush features-update -y"
alias drfra="drush features-revert-all"
alias drif="drush image-flush --all"
alias drpm="drush pm-list --type=module"
alias drst="drush core-status"
alias drup="drush updatedb"
alias drups="drush updatedb-status"
alias drv="drush version"
alias drvd="drush variable-del"
alias drvg="drush variable-get"
alias drvs="drush variable-set"
# Enable drush autocomplete support
autoload bashcompinit
bashcompinit
source $(dirname $0)/drush.complete.sh
# Emacs plugin
This plugin utilizes the Emacs daemon capability, allowing the user to quickly open frames, whether they are opened in a terminal via a ssh connection, or X frames opened on the same host. The plugin also provides some aliases for such operations.
- You don't have the cost of starting Emacs all the time anymore
- Opening a file is as fast as Emacs does not have anything else to do.
- You can share opened buffered across opened frames.
- Configuration changes made at runtime are applied to all frames.
**NOTE:** requires Emacs 24 and newer.
To use it, add emacs to the plugins array in your zshrc file:
```zsh
plugins=(... emacs)
```
## Aliases
The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that is just a wrapper around [`emacsclient`](https://www.emacswiki.org/emacs/EmacsClient).
| Alias | Command | Description |
|--------|----------------------------------------------------|----------------------------------------------------------------|
| emacs | `$EMACS_LAUNCHER --no-wait` | Opens a temporary emacsclient frame |
| e | `emacs` | Same as emacs alias |
| te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient |
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor "" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer |
| ecd | - | Print the directory of the file open in the the current buffer |
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# - Configuration changes made at runtime are applied to all frames. # - Configuration changes made at runtime are applied to all frames.
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
# set EDITOR if not already defined. # set EDITOR if not already defined.
......
# Ember CLI # Ember CLI
**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa) **Maintainers:** [BilalBudhani](https://github.com/BilalBudhani), [eubenesa](https://github.com/eubenesa), [scottkidder](https://github.com/scottkidder]
Ember CLI (http://www.ember-cli.com/) Ember CLI (https://www.ember-cli.com/)
### List of Aliases ### List of Aliases
...@@ -17,5 +17,6 @@ Alias | Ember-CLI command ...@@ -17,5 +17,6 @@ Alias | Ember-CLI command
**ein** | *ember init* **ein** | *ember init*
**ei** | *ember install* **ei** | *ember install*
**et** | *ember test* **et** | *ember test*
**ets** | *ember test --serve*
**eu** | *ember update* **eu** | *ember update*
**ev** | *ember version* **ev** | *ember version*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment