_git-journal() { local i cur prev opts cmds COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cmd="" opts="" for i in ${COMP_WORDS[@]} do case "${i}" in git-journal) cmd="git-journal" ;; help) cmd+="__help" ;; p) cmd+="__p" ;; prepare) cmd+="__prepare" ;; s) cmd+="__s" ;; setup) cmd+="__setup" ;; v) cmd+="__v" ;; verify) cmd+="__verify" ;; *) ;; esac done case "${cmd}" in git-journal) opts=" -a -g -s -u -h -V -p -n -e -t -o --all --generate --short --skip-unreleased --help --version --path --tags-count --template --output prepare setup verify help p s v" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi case "${prev}" in --path) COMPREPLY=("") return 0 ;; -p) COMPREPLY=("") return 0 ;; --tags-count) COMPREPLY=("") return 0 ;; -n) COMPREPLY=("") return 0 ;; -e) COMPREPLY=("") return 0 ;; --template) COMPREPLY=("