Search code examples
zshzsh-completion

zsh autocompletion for sudo-like command


I have a tool that runs other tools, that I would like to enable completion from the commands it runs. For example:

mytool git grep --<TAB>

Should autocomplete for git grep. This works fine with e.g. sudo:

sudo git grep --<TAB>

Shows the autocompletions for git grep.

How do I achieve this with my own tool?


Solution

  • Just call _normal, just like _sudo does.

    See also the documentation for _normal.