prev
contém parm
e cur
contém =
e compgen -W "a b c" -- =
não produz nada
Você pode usar _get_comp_words_by_ref
de conclusão do bash :
source bash-completion # /usr/share/bash-completion/bash_completion on Ubuntu with bash-complete installed
function _completion_command() {
local cur prev
_get_comp_words_by_ref -n = cur prev
case "$prev" in
-u)
case "$cur" in
parm=*)
COMPREPLY=($(compgen -W "a b c" -- ${cur#*=}))
return 0;
;;
*)
compopt -o nospace
COMPREPLY=($(compgen -S\= -W "parm" -- $cur))
return 0;
;;
esac
;;
esac
COMPREPLY=($(compgen -W "-u" -- $cur))
}
complete -F _completion_command command