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

suvayu ali fatkasuvayu+linux at gmail.com
Thu May 31 17:25:56 UTC 2012


Hi,

(Please CC: me in your responses, I'm not subscribed to the list)

I have many wrapper functions scripts for standard tools. I used to
define the original completion function as the completion function for
my wrappers. That seems to not work any more when tried for the first
time with the move to dynamic completion loading (I encountered this
when upgrading to F17 from F16).

To give you an example:

 $ function find_ext() { echo "dummy wrapper fn for find"; }
 $ complete -F _find find_ext

Earlier the above would let me have completion on find options for my
wrapper. With dynamic completion loading, I get the following.

 $ complete -p find_ext
 complete -F _find find_ext
 $ complete -p find
 -bash: complete: find: no completion specification
 $ find_ext [TAB] -bash: completion: function `_find' not found

Of course, once I have tried to complete for find I can complete on my
wrapper too (as shown below).

 $ find -t [TAB] [TAB]
 -true  -type
 $ complete -p find
 complete -F _find find
 $ find_ext -t [TAB] [TAB]
 -true  -type

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?

As I was writing this email I looked up the docs once more and thought
of writing my own default function which wraps around
_completion_loader. However I haven't been able to come up with a
working implementation yet (I'm bit of a noob). Is this the correct way
to proceed, can someone help with some hints?

BTW, Thanks a lot for developing bash-completion. Its an incredibly
useful package. :)

-- 
Suvayu

Open source is the future. It sets us free.



More information about the Bash-completion-devel mailing list