I\'m trying to construct a bash completion routine that will suggest command lines flags and suitable flag values. For example in the below fstcompose comma
Your first return 0 prevents the second if from being evaluated. Try using a case statement ordered from most-specific to least-specific or at least order your if statements that way.
Since "=" is included in $COMP_WORDBREAKS, ${prev} is "--compose_filter" without the "=".
If you remove "=" from $COMP_WORDBREAKS then --compose_filter is still ${cur} rather than ${prev}. Doing so without preserving and restoring its value will break other completions.
I'm not sure what other problems there may be.
You can pepper your function with echo statements that are redirected to another terminal to aid in debugging. For example:
echo "cur: $cur, prev: $prev" > /dev/pts/2