1 # SPDX-License-Identifier: BSD-2-Clause
4 # shfmt --language-dialect bash --indent 4 --func-next-line
14 ['forward-compatible']=''
17 ['reset-notification']=''
22 local versions=(1.{0..5} 2.{0..1} 3.{0..3} 4.{0..6})
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'
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"))
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}"))
51 COMPREPLY+=($(compgen -P '-' -W "${opts[*]}" -- "${cur:1}"))
53 COMPREPLY=($(compgen -P '-' -W "${opts[*]}" -- "${cur:1}"))
54 COMPREPLY+=($(compgen -P '--' -W "${!opts[*]}" -- "${cur:2}"))
57 complete -F _wflinfo wflinfo