[Bash-completion-devel] Completion functions for wrappers for standard tools

Ville Skyttä ville.skytta at iki.fi
Thu May 31 19:24:21 UTC 2012


On 2012-05-31 20:25, suvayu ali wrote:

>  $ function find_ext() { echo "dummy wrapper fn for find"; }
>  $ complete -F _find find_ext
[...]
> So my question is, how do you enable completion for my wrappers such
> that it works even when I try it for the first time?

I'd look into loading needed functions on demand using _xfunc - that's
how interdependent snippets shipped with bash-completion itself do it.
For example:

$ find_ext() { echo "dummy wrapper fn for find"; }
$ _find_ext() { _xfunc find _find; }
$ complete -F _find_ext find_ext
$ find_ext -t<TAB>
-true  -type



More information about the Bash-completion-devel mailing list