You can redispatch into the normal completion system by calling the _normal
function, but first you need to modify some of the state so that it will ignore your program name and possibly its arguments. A very simple version of this can be done with:
#compdef foo
shift words
(( CURRENT-- ))
_normal
If you need to get more complicated that that (which is likely), you can take a look at the completion definitions for other commands that call _normal
, such as the completions for env
, sudo
, or fakeroot
.