source: scripts/etc/bash_completion.d/7dtd@ 305

Last change on this file since 305 was 19, checked in by alloc, 11 years ago

Instance management

File size: 651 bytes
RevLine 
[19]1if [ $(id -u) -eq 0 ]; then
2 _sdtd() {
3 . /usr/local/lib/7dtd/common.sh
4 checkRootLoadConf
[17]5
[19]6 local cur prev opts
7 COMPREPLY=()
8 cur="${COMP_WORDS[COMP_CWORD]}"
9 prev="${COMP_WORDS[COMP_CWORD-1]}"
[17]10
[19]11 opts="help $(listCommands)"
12
13 case "${COMP_CWORD}" in
14 1)
15 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
[17]16 return 0
[19]17 ;;
18 *)
19 if [ "$(type -t sdtdCommand$(camelcasePrep ${COMP_WORDS[1]})Expects)" = "function" ]; then
20 local words="$(sdtdCommand$(camelcasePrep ${COMP_WORDS[1]})Expects $COMP_CWORD $prev)"
21 COMPREPLY=( $(compgen -W "$words" -- ${cur}) )
22 return 0
23 fi
24 ;;
25 esac
26 }
27 complete -F _sdtd 7dtd.sh
28fi
Note: See TracBrowser for help on using the repository browser.