I'm not sure about the arguments to the _get_comp_words_by_ref function.
Passing multiple [cur] [prev] [prev2].. arguments doesn't seem all that
useful. More than cur and prev would very rarely be useful; and in such
a case it might be better to just fetch the array and current index.

So what about turning this into --cur --prev with default arguments?

Having a single function avoids multiple __reassemble_comp_words_by_ref
calls further down, so I guess it's worth doing for performance. But it
would be nicer to just reimplement _get_cword with a cache. Otherwise
anything that uses __reassemble_comp_words_by_ref would be turn into an
argument to _get_comp_words_by_ref (think _count_args).

Unfortunately a cache is impossible to implement without leaking
variables to the shell environment. Maybe bash-completion-lib has a way
to execute cleanup code after every completion?


_______________________________________________
Bash-completion-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel

Reply via email to