Warning, /games/kajongg/bash_completion.d/kajongg is written in an unsupported language. File is not indexed.

0001 _kajongg()
0002 {
0003     _rulesets()
0004     {
0005         ${COMP_WORDS[0]} --rulesets
0006     }
0007     local cur prev opts
0008     COMPREPLY=()
0009     cur="${COMP_WORDS[COMP_CWORD]}"
0010     prev="${COMP_WORDS[COMP_CWORD-1]}"
0011     if [[ "$prev" == "--autoplay" ]]; then
0012         prevIFS=$IFS
0013         local IFS=:
0014         export IFS
0015         set - `kde-config --path data`
0016         database="$1"/kajongg/kajongg.db
0017         if test -r "$database" ; then
0018             # a ruleset name can contain spaces. I am sure this could be handled here
0019             # right now the user needs to enter a ' before autocompleting the ruleset
0020             IFS=$'\n'
0021             export IFS
0022             COMPREPLY=( $(compgen -W "$(_rulesets)" -- ${cur}) )
0023             IFS="$prevIFS"
0024             return 0
0025         fi
0026         IFS="$prevIFS"
0027     fi
0028     opts="--help --help-qt --help-kde --help-all --author --version --license --playopen --autoplay --rulesets --debug --seed --nogui --ai --csv"
0029 
0030     if [[ ${cur} == -* ]] ; then
0031         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
0032         return 0
0033     fi
0034 }
0035 complete -F _kajongg kajongg
0036 complete -F _kajongg kajongg.py