kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

Make activate-global-python-argcomplete compatible with zsh #411

Closed kislyuk closed 1 year ago

kislyuk commented 1 year ago

activate-global-python-argcomplete doesn't work in zsh, probably because zsh doesn't support complete -D. Figure out what the zsh equivalent is, and use that instead of calling complete -D when zsh is detected.

kislyuk commented 1 year ago

https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Autoloaded-files

If the #compdef line contains one of the options -p or -P, the words following are taken to be patterns. The function will be called when completion is attempted for a command or context that matches one of the patterns. The options -p and -P are used to specify patterns to be tried before or after other completions respectively. Hence -P may be used to specify default actions. The option -N is used after a list following -p or -P; it specifies that remaining words no longer define patterns. It is possible to toggle between the three options as many times as necessary.