updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / srb2-bin / srb2.bashcomp
blob7ff0640247772ab705b0a76621937f5c9ac4c178
1 #!/bin/bash
3 _srb2()
5 local soptions="-opengl -connect -mousegrab -bandwidth
6 -bindaddr -clientport -config -compress
7 -consisdump -console -coopsound -debug
8 -debugfile -dedicated -extratic -framebuffer
9 -freq -gametype -gettickcount -height -home
10 -internetserver -ipx -maxdemo -noblit -nodigimusic
11 -nodinput -nodownload -nodownloading -nodraw
12 -noendtxt -noerror -nofiles -nojoy -nomidimusic
13 -nomouse -nomusic -nosound -openal -packetsize
14 -password -playdemo -precachesound -record
15 -resetdata -room -server -silent -sounddriver
16 -timedemo -timetic -udpport -ultimatemode -usecd
17 -voodoo -warp -width -win -winmidi"
18 local moptions="-file"
20 local cur=`_get_cword`
21 local prev="${COMP_WORDS[COMP_CWORD-1]}"
23 case "$prev" in
24 "-room")
25 COMPREPLY=(33 28)
27 "-gametype")
28 COMPREPLY=(0 1 2 3 4)
30 "-file" | "-config" | "-home")
31 _filedir
33 "-connect")
34 if [[ -e "/usr/bin/xclip" ]]; then
35 addr="`xclip -out`"
36 if [[ "$addr" == *.*.*.* ]]; then
38 else
39 addr=
42 COMPREPLY=($addr)
45 if [[ "$cur" == -* ]]; then
46 COMPREPLY=($(compgen -W "$soptions $moptions" -- "$cur"))
47 cw=""
48 for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
49 for sopt in $soptions; do
50 if [[ "$sopt" == "${COMP_WORDS[i]}" ]]; then
51 for r in ${!COMPREPLY[@]}; do
52 if [[ "$sopt" == "${COMPREPLY[r]}" ]]; then
53 unset 'COMPREPLY[r]'
54 break
56 done
58 done
59 done
60 else
61 for ((i=${#COMP_WORDS[@]}-1; i >= 0; i--)); do
62 if [[ "${COMP_WORDS[i]}" == -* ]]; then
63 if [[ "${COMP_WORDS[i]}" == "-file" ]]; then
64 _filedir
65 return
66 else
67 return
70 done
72 COMPREPLY=()
75 esac
78 complete $filenames -F _srb2 srb2