I've wrote the following sample completion for :
command (to understand why completion fails):
__sample_complete()
{
local OPTIONS=('--first' '--first=')
local FIRST_ARGUMENTS=('arg1' 'arg2')
local current=$2
local previous=$3
case $current in
--first=*)
current=${current##--first*,}
readarray -t COMPREPLY < <(compgen -o nospace -W "${FIRST_ARGUMENTS[*]}" -- "$current")
;;
*)
readarray -t COMPREPLY < <(compgen -W "${OPTIONS[*]}" -- "$current")
;;
esac
}
complete -F __sample_complete :
I wanna see arg1
arg2
suggestions when I type : --first=
but now Bash automatically on tab press completes it with --first
: --first=--first
.