1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
_wflinfo() {
local cur prev
if _get_comp_words_by_ref -n= cur prev &>/dev/null; then
case $prev in
-p|--platform)
COMPREPLY=($(compgen -W 'android cgl gbm glx surfaceless_egl sl wayland wgl x11_egl' -- "$cur"))
return
;;
-a|--api)
COMPREPLY=($(compgen -W 'gl gles1 gles2 gles3' -- "$cur"))
return
;;
-V|--version)
local versions=(1.{0..5} 2.{0..1} 3.{0..3} 4.{0..6})
COMPREPLY=($(compgen -W "${versions[*]}" -- "$cur"))
return
;;
--profile)
COMPREPLY=($(compgen -W 'core compat none' -- "$cur"))
return
;;
-f|--format)
COMPREPLY=($(compgen -W 'original json' -- "$cur"))
return
;;
esac
else
cur="${COMP_WORDS[COMP_CWORD]}"
fi
local shortopts=(
p
a
V
v
f
h
)
local longopts=(
platform
api
version
profile
verbose
forward-compatible
debug-context
format
help
)
if [[ "$cur" == "--"* ]]; then
COMPREPLY=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
elif [[ "$cur" == "-"* && ${#cur} -gt 1 ]]; then
COMPREPLY=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
else
COMPREPLY=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")
$(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
fi
} &&
complete -F _wflinfo wflinfo
|