_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=" -p -a -g -s -u -n -e -t -o -h -V --path --all --generate --short --skip-unreleased --tags-count --template --output --help --version 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=("