2017-01-18 23:22:11 +08:00
|
|
|
if which rabbitmqctl > /dev/null; then
|
2017-01-17 01:57:42 +08:00
|
|
|
if [ -n "$BASH_VERSION" ]; then
|
|
|
|
_rabbitmqctl_complete() {
|
|
|
|
COMPREPLY=()
|
2017-01-18 23:22:11 +08:00
|
|
|
local LANG=en_US.UTF-8
|
2017-01-17 01:57:42 +08:00
|
|
|
local word="${COMP_WORDS[COMP_CWORD]}"
|
2017-01-24 22:44:45 +08:00
|
|
|
local completions="$(/usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete $COMP_LINE)"
|
2017-01-17 01:57:42 +08:00
|
|
|
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -f -F _rabbitmqctl_complete rabbitmqctl
|
|
|
|
elif [ -n "$ZSH_VERSION" ]; then
|
|
|
|
_rabbitmqctl_complete() {
|
|
|
|
local word completions a
|
2017-01-18 23:22:11 +08:00
|
|
|
local LANG=en_US.UTF-8
|
2017-01-17 01:57:42 +08:00
|
|
|
read -cl a
|
|
|
|
word="$1"
|
2017-01-24 22:44:45 +08:00
|
|
|
completions="$(/usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete ${a})"
|
2017-01-17 01:57:42 +08:00
|
|
|
reply=( "${(ps:\n:)completions}" )
|
|
|
|
}
|
|
|
|
|
|
|
|
compctl -f -K _rabbitmqctl_complete rabbitmqctl
|
|
|
|
fi
|
|
|
|
fi
|