Check for rabbitmqctl using `[ -x ]` and not `which` in autocompletion
This commit is contained in:
parent
b9f2df696d
commit
cd804aeb4a
|
@ -1,9 +1,11 @@
|
||||||
_rabbitmqctl_complete() {
|
_rabbitmqctl_complete() {
|
||||||
|
if [ -x /usr/lib/rabbitmq/bin/rabbitmqctl ]; then
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
local LANG=en_US.UTF-8
|
local LANG=en_US.UTF-8
|
||||||
local word="${COMP_WORDS[COMP_CWORD]}"
|
local word="${COMP_WORDS[COMP_CWORD]}"
|
||||||
local completions="$(export LANG=en_US.UTF-8; export LC_CTYPE=en_US.UTF-8; /usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete $COMP_LINE)"
|
local completions="$(export LANG=en_US.UTF-8; export LC_CTYPE=en_US.UTF-8; /usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete $COMP_LINE)"
|
||||||
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
|
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -f -F _rabbitmqctl_complete rabbitmqctl
|
complete -f -F _rabbitmqctl_complete rabbitmqctl
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
if which rabbitmqctl > /dev/null; then
|
|
||||||
if [ -n "$BASH_VERSION" ]; then
|
if [ -n "$BASH_VERSION" ]; then
|
||||||
. /usr/lib/rabbitmq/autocomplete/bash_autocomplete.sh
|
. /usr/lib/rabbitmq/autocomplete/bash_autocomplete.sh
|
||||||
fi
|
fi
|
||||||
fi
|
|
|
@ -1,10 +1,12 @@
|
||||||
_rabbitmqctl_complete() {
|
_rabbitmqctl_complete() {
|
||||||
|
if [ -x /usr/lib/rabbitmq/bin/rabbitmqctl ]; then
|
||||||
local word completions a
|
local word completions a
|
||||||
local LANG=en_US.UTF-8
|
local LANG=en_US.UTF-8
|
||||||
read -cl a
|
read -cl a
|
||||||
word="$1"
|
word="$1"
|
||||||
completions="$(export LANG=en_US.UTF-8; export LC_CTYPE=en_US.UTF-8; /usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete ${=a})"
|
completions="$(export LANG=en_US.UTF-8; export LC_CTYPE=en_US.UTF-8; /usr/lib/rabbitmq/bin/rabbitmqctl --auto-complete ${=a})"
|
||||||
reply=( "${(ps:\n:)completions}" )
|
reply=( "${(ps:\n:)completions}" )
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compctl -f -K _rabbitmqctl_complete rabbitmqctl
|
compctl -f -K _rabbitmqctl_complete rabbitmqctl
|
||||||
|
|
Loading…
Reference in New Issue