zsh
zsh is a shell alternative to bash. It comes pre-installed on MacOS.
Autocompletion setup
fpath=(~/.zsh/functions $fpath)
autoload -Uz compinit
compinit
Completion functions must be located on the $fpath with the name that matches their #compdef:
$ cat ~/.zsh/functions/_gh | head -n 1
#compdef gh