Here's a tutorial on creating zsh completion scripts:
https://github.com/zsh-users/zsh-completions/blob/master/zsh...
The zsh completion system is better than the bash one; it has a builtin menu system, or you can use fzf: https://github.com/junegunn/fzf