Debian Codegraph @

scripts/bash_completion/bumblebee

raw
1 # bash completion for bumblebee
2
3 _optirun() {
4 local i prev cur last_optirun_offset compress_types in_option
5
6 in_option=false
7 # the position of the last optirun arguments part
8 last_optirun_offset=0
9 compress_types='proxy jpeg rgb xv yuv'
10
11 for (( i=1; i<=COMP_CWORD; i++ )); do
12 prev="${COMP_WORDS[i-1]}"
13 cur="${COMP_WORDS[i]}"
14
15 if $in_option; then
16 in_option=false
17 else
18 case "$prev" in
19 -c|--vgl-compress|--failsafe|--display|-d|--config|-C|--ldpath|-l|--primus-ldpath|--socket|-s|-b|--bridge)
20 in_option=true
21 ;;
22 --)
23 break
24 ;;
25 esac
26 fi
27
28 if ! $in_option; then
29 [[ "$cur" != -* ]] && break
30 fi
31
32 last_optirun_offset=$i
33 done
34
35 if [ $last_optirun_offset -eq $COMP_CWORD ]; then
36 case "$prev" in
37 -b|--bridge)
38 COMPREPLY=( $(compgen -W "auto primus virtualgl" -- "$cur") )
39 ;;
40 -c|--vgl-compress)
41 COMPREPLY=( $(compgen -W "$compress_types" -- "$cur") )
42 ;;
43 --failsafe)
44 COMPREPLY=( $(compgen -W "true false" -- "$cur") )
45 ;;
46 -d|--display)
47 # XXX: find active bumblebee X servers and suggest these
48 ;;
49 -C|--config|-s|--socket)
50 _filedir
51 ;;
52 -l|--ldpath|--primus-ldpath)
53 ;;
54 *)
55 COMPREPLY=( $(compgen -W "--vgl-compress -c --failsafe --quiet \
56 --silent -q --verbose -v --display -d --config -C --ldpath -l \
57 --primus-ldpath --socket -s --help -h --" -- "$cur") )
58 ;;
59 esac
60 return 0
61 fi
62
63 # after the options, auto-complete command
64 _command_offset $i
65 }
66 have optirun && complete -F _optirun optirun
67