ttrts/scripts/ttrts_complete

25 lines
492 B
Text
Raw Normal View History

# ttrts completion
test ! -z TTRTS_MAPS && TTRTS_MAPS=/usr/share/ttrts/maps/
have ttrts &&
function _ttrts
{
commandnames="--server --client --map --host localhost "
for filename in ${TTRTS_MAPS}/*
do
map="${filename##*/}"
commandnames+="--map=$map "
commandnames+="$map "
done
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=( $(compgen -W "${commandnames}" -- ${cur}) )
}
complete -F _ttrts ttrts