Created plugin
Redesigned for completions of actual command not alias
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
#compdef docker-project-manager
|
||||||
|
|
||||||
|
_docker_project_manager_comp() {
|
||||||
|
_arguments '--pull[Pull the project]' \
|
||||||
|
'*:projects:_files -W /docker -/' \
|
||||||
|
+ '(action)' \
|
||||||
|
'--up[Start the project]' \
|
||||||
|
'--down[Stop the project]' \
|
||||||
|
'--restart[Restart the project]'
|
||||||
|
}
|
||||||
|
|
||||||
|
_docker_project_manager_comp "$@"
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
alias dcd='docker-project-manager --down'
|
||||||
|
alias dcu='docker-project-manager --up'
|
||||||
|
alias dcr='docker-project-manager --restart'
|
||||||
|
alias dcp='docker-project-manager --restart --pull'
|
||||||
|
|
||||||
|
if (( ! $+commands[docker-project-manager] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Standardized $0 handling
|
||||||
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||||
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `docker-project-manager`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker-project-manager" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _docker-project-manager
|
||||||
|
_comps[docker-project-manager]=_docker-project-manager
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
command cp "${0:h}/completions/_docker-project-manager" "$ZSH_CACHE_DIR/completions/_docker-project-manager"
|
||||||
|
} &
|
||||||
Reference in New Issue
Block a user