I have a program that is similar to git in that git foo
and git-foo
are both valid ways to invoke it. I have rudimentary tab completion written for the git foo
version, and I would like to use it for git-*
. But for various reasons, it's non-trivial (in fact, impossible since I can add new commands at any time) to know the list of all git-*
commands before hand, so I need a way to run something like
complete -F _my_git_completion git-*
But that line doesn't work since expands git-*
at the time of invocation with files that are in the current directory. This isn't helpful since my files aren't in the current directory.
I vaguely remember a hook that's called the first time completion is tried for a new executable, but I can't find it now. Is there such a thing?