kislyuk/argcomplete

Generating lazy completion scripts for Bash/Zsh

Closed this issue · 1 comments

It would be nice to be able to generate lazy loaded completion scripts for Bash and Zsh instead of having to eagerly register and execute them at shell startup by register-python-argcomplete. For Bash, it is likely the existing script can be used as is, for Zsh, you need #compdef <command> as the first line and to not call compdef but rather call the completion function directly, there is probably a trick or two to make the script work as both. I think click-completion uses one https://github.com/click-contrib/click-completion/blob/master/click_completion/zsh.j2, and also cobra https://github.com/spf13/cobra/blob/main/zsh_completions.go, but there are also others, not sure which is the best.

Yes, that would be nice. PRs are welcome.