_mole_completions()
{
    local cur_word prev_word
    cur_word="${COMP_WORDS[$COMP_CWORD]}"
    prev_word="${COMP_WORDS[$COMP_CWORD-1]}"

    if [ "$COMP_CWORD" -eq 1 ]; then
        COMPREPLY=( $(compgen -W "clean uninstall optimize analyze status purge installer touchid completion update remove help version" -- "$cur_word") )
    else
        case "$prev_word" in
            completion)
                COMPREPLY=( $(compgen -W "bash zsh fish" -- "$cur_word") )
                ;;
            *)
                COMPREPLY=()
                ;;
        esac
    fi
}

complete -F _mole_completions mole mo
