Reworked ZSH completion. It's now a function that should explicitely loaded on startup
This commit is contained in:
parent
97b7e6a687
commit
7835f4c9c9
|
@ -73,7 +73,9 @@ install -p -D -m 0755 %{S:1} %{buildroot}%{_initrddir}/rabbitmq-server
|
|||
install -p -D -m 0755 %{_rabbit_server_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server
|
||||
install -p -D -m 0755 %{_rabbit_server_ha_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha
|
||||
install -p -D -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server
|
||||
|
||||
install -p -D -m 0755 %{_rabbitmqctl_autocomplete} %{buildroot}%{_sysconfdir}/profile.d/rabbitmqctl-autocomplete.sh
|
||||
install -p -D -m 0755 scripts/zsh_autocomplete.sh %{buildroot}%{_datarootdir}/zsh/vendor-functions/_enable_rabbitmqctl_completion
|
||||
|
||||
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/rabbitmq
|
||||
|
@ -203,6 +205,7 @@ fi
|
|||
%endif
|
||||
|
||||
%{_sysconfdir}/profile.d/rabbitmqctl-autocomplete.sh
|
||||
%{_datarootdir}/zsh/vendor-functions/_enable_rabbitmqctl_completion
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/rabbitmq-server
|
||||
%doc LICENSE*
|
||||
|
|
|
@ -40,6 +40,11 @@ chmod -R o-rwx,g-w /var/lib/rabbitmq/mnesia
|
|||
|
||||
case "$1" in
|
||||
configure)
|
||||
if [ -n "$ZSH_VERSION" ]; then
|
||||
echo "Z Shell detected.
|
||||
to enable rabbitmqctl autocompletion add the following to your .zshrc file:
|
||||
autoload _enable_rabbitmqctl_completion; _enable_rabbitmqctl_completion"
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
|
|
|
@ -25,7 +25,8 @@ remove_plugin_traces() {
|
|||
|
||||
remove_autocomplete_script() {
|
||||
if [ -f /etc/profile.d/rabbitmqctl-autocomplete.sh ]; then
|
||||
rm -r /etc/profile.d/rabbitmqctl-autocomplete.sh
|
||||
rm -rf /etc/profile.d/rabbitmqctl-autocomplete.sh
|
||||
rm -rf /usr/share/zsh/vendor-functions/_enable_rabbitmqctl_completion
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@ override_dh_auto_install:
|
|||
install -p -D -m 0755 scripts/rabbitmqctl-autocomplete.sh \
|
||||
$(DEB_DESTDIR)/etc/profile.d/rabbitmqctl-autocomplete.sh
|
||||
|
||||
install -p -D -m -755 scripts/zsh_autocomplete.sh \
|
||||
$(DEB_DESTDIR)/usr/share/zsh/vendor-functions/_enable_rabbitmqctl_completion
|
||||
|
||||
rm $(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/LICENSE* \
|
||||
$(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/INSTALL
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ _rabbitmqctl_complete() {
|
|||
COMPREPLY=()
|
||||
local LANG=en_US.UTF-8
|
||||
local word="${COMP_WORDS[COMP_CWORD]}"
|
||||
local completions="$(/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") )
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
if which rabbitmqctl > /dev/null; then
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
. /usr/lib/rabbitmq/autocomplete/bash_autocomplete.sh
|
||||
|
||||
elif [ -n "$ZSH_VERSION" ]; then
|
||||
. /usr/lib/rabbitmq/autocomplete/zsh_autocomplete.sh
|
||||
fi
|
||||
fi
|
|
@ -3,7 +3,7 @@ _rabbitmqctl_complete() {
|
|||
local LANG=en_US.UTF-8
|
||||
read -cl a
|
||||
word="$1"
|
||||
completions="$(/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}" )
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue