flexisip/scripts/flexisip.bash-completion
2025-06-16 13:54:12 +07:00

49 lines
1.4 KiB
Bash

#Copying and distribution of this file, with or without modification,
#are permitted in any medium without royalty provided the copyright
#notice and this notice are preserved. This file is offered as-is,
#without any warranty
#-*- mode: shell-script;-*-
_flexisip_completion()
{
local cur prev cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev=${COMP_WORDS[COMP_CWORD-1]}
# flexisip main commands
cmds='--transports --debug --daemon --config -c\
--dump-default --dump-mibs --help --set --list-settables'
# if no command were given, complete on commands
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
# Complete depending on options
case ${prev} in
--transports)
COMPREPLY=( $(compgen -W '"<sip:' -- $cur ))
;;
--configfile|-c)
COMPREPLY=( $(compgen -o filenames -f -- $cur ))
;;
--set)
local allsettables=`flexisip --list-settables`
#oifs=$IFS
#IFS=$'\n' COMPREPLY=($(IFS=$'\n' compgen -W "`flexisip --list-settables`" -- $cur ))
#IFS=$oifs
local IFS=$'\n'
COMPREPLY=( $(compgen -W "$allsettables" -- $cur))
;;
--debug|--daemon|--list-settables)
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
;;
esac
return 0
}
complete -F _flexisip_completion -o filenames flexisip