25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Support the recent changes in the "ejabberdctl help" command (#3569)

This commit is contained in:
Badlop 2021-04-15 19:24:30 +02:00
parent 0ec69f0279
commit 4914b33f8c

View File

@ -4,12 +4,15 @@
get_help() get_help()
{ {
local COMMANDCACHE=/var/log/ejabberd/bash_completion_$RANDOM local COMMANDCACHE=/var/log/ejabberd/bash_completion_$RANDOM
ejabberdctl $CTLARGS help >$COMMANDCACHE ejabberdctl $CTLARGS help tags >$COMMANDCACHE.tags
ejabberdctl $CTLARGS >$COMMANDCACHE
if [[ $? == 2 ]] ; then if [[ $? == 2 ]] ; then
ISRUNNING=1 ISRUNNING=1
runningcommands=`cat $COMMANDCACHE | grep "^ [a-z]" | awk '{print $1}' | xargs` runningcommands=`cat $COMMANDCACHE | grep "^ [a-z]" | awk '{print $1}' | xargs`
runningtags=`cat $COMMANDCACHE.tags | grep "^ [a-z]" | awk '{print $1}' | xargs`
fi fi
rm $COMMANDCACHE rm $COMMANDCACHE
rm $COMMANDCACHE.tags
} }
_ejabberdctl() _ejabberdctl()
@ -22,8 +25,8 @@ _ejabberdctl()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
local startcoms="start debug live" local startcoms="start foreground foreground-quiet live debug etop iexdebug iexlive ping started stopped"
local startpars="--config-dir --config --ctl-config --logs --spool" local startpars="--config-dir --config --ctl-config --logs --node --spool"
local i=1 local i=1
local CTLARGS="" local CTLARGS=""
@ -55,7 +58,7 @@ _ejabberdctl()
;; ;;
help) help)
get_help get_help
COMPREPLY=($(compgen -W "${runningcommands}" -- $cur)) COMPREPLY=($(compgen -W "${runningcommands} ${runningtags}" -- $cur))
return 0 return 0
;; ;;
--node) --node)