gitlab-ci: enable sanitizers for the meson builds
[mesa-waffle.git] / shell-completion / bash / wflinfo
blob3ca934ed343b55cf6d255e818b5e45211094baf8
1 # SPDX-License-Identifier: BSD-2-Clause
3 # Formatted using:
4 # shfmt --language-dialect bash --indent 4 --func-next-line
5 _wflinfo()
7     # long/short opt pairs
8     local -A opts=(
9         ['platform']='p'
10         ['api']='a'
11         ['version']='V'
12         ['profile']=''
13         ['verbose']='v'
14         ['forward-compatible']=''
15         ['debug-context']=''
16         ['robust-context']=''
17         ['reset-notification']=''
18         ['format']='f'
19         ['help']='h'
20     )
22     local versions=(1.{0..5} 2.{0..1} 3.{0..3} 4.{0..6})
24     # long opt/arg pairs
25     local -A args=(
26         ['platform']='android cgl gbm glx surfaceless_egl sl wayland wgl x11_egl'
27         ['api']='gl gles1 gles2 gles3'
28         ['version']="${versions[*]}"
29         ['profile']='core compat none'
30         ['format']='original json'
31     )
33     local cur prev
34     _get_comp_words_by_ref cur prev
36     for opt in ${!opts[*]}; do
37         if [[ $prev == -${opts[$opt]} ]] || [[ $prev == --$opt ]]; then
38             local arg="${args[$opt]}"
39             [[ $arg ]] || continue
40             COMPREPLY=($(compgen -W "$arg" -- "$cur"))
41             return
42         fi
43     done
45     if [[ $cur == --* ]]; then
46         COMPREPLY=($(compgen -P '--' -W "${!opts[*]}" -- "${cur:2}"))
47     elif [[ $cur == -* ]]; then
48         if (( ${#cur} != 2 )); then
49             COMPREPLY=($(compgen -P '--' -W "${!opts[*]}" -- "${cur:2}"))
50         fi
51         COMPREPLY+=($(compgen -P '-' -W "${opts[*]}" -- "${cur:1}"))
52     else
53         COMPREPLY=($(compgen -P '-' -W "${opts[*]}" -- "${cur:1}"))
54         COMPREPLY+=($(compgen -P '--' -W "${!opts[*]}" -- "${cur:2}"))
55     fi
56 } &&
57     complete -F _wflinfo wflinfo