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

suvayu ali fatkasuvayu+linux at gmail.com
Thu May 31 19:41:10 UTC 2012


Hi Ville,

On Thu, May 31, 2012 at 9:24 PM, Ville Skyttä <ville.skytta at iki.fi> wrote:
> 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

Thanks a lot for this solution. In the mean time I came up with my own
wrapper for _completion_loader[1] but your solution is much simpler.

Thanks a lot. :)

Footnotes:

[1] <http://lists.fedoraproject.org/pipermail/users/2012-May/418944.html>


-- 
Suvayu

Open source is the future. It sets us free.



More information about the Bash-completion-devel mailing list