Changeset 19 for scripts/etc
- Timestamp:
- May 23, 2014, 6:39:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/etc/bash_completion.d/7dtd
r18 r19 1 . /usr/local/lib/7dtd/common.sh 2 checkRootLoadConf 1 if [ $(id -u) -eq 0 ]; then 2 _sdtd() { 3 . /usr/local/lib/7dtd/common.sh 4 checkRootLoadConf 3 5 4 _sdtd() { 5 local cur prev opts 6 COMPREPLY=() 7 cur="${COMP_WORDS[COMP_CWORD]}" 8 prev="${COMP_WORDS[COMP_CWORD-1]}" 6 local cur prev opts 7 COMPREPLY=() 8 cur="${COMP_WORDS[COMP_CWORD]}" 9 prev="${COMP_WORDS[COMP_CWORD-1]}" 9 10 10 opts="help $(listCommands)" 11 12 case "${COMP_CWORD}" in 13 1) 14 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 15 return 0 16 ;; 17 *) 18 if [ "$(type -t sdtdCommand$(camelcasePrep ${COMP_WORDS[1]})Expects)" = "function" ]; then 19 COMPREPLY=( $(compgen -W "$(sdtdCommand$(camelcasePrep ${COMP_WORDS[1]})Expects $COMP_CWORD)" -- ${cur}) ) 11 opts="help $(listCommands)" 12 13 case "${COMP_CWORD}" in 14 1) 15 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 20 16 return 0 21 fi 22 ;; 23 esac 24 } 25 complete -F _sdtd 7dtd.sh 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 28 fi
Note:
See TracChangeset
for help on using the changeset viewer.