# Copyright 2013-2015, Red Hat, Inc.
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# This software is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this software; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
# site: http://www.fsf.org.
#
# Completion for Zanata Java command-line client
# Generated by BashCompletionGenerator
#
_zanata()
{
    local cur prev opts base cmds
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    base="${COMP_WORDS[1]}"
    cmds="init list-remote pull push put-project put-user put-version stats glossary-delete glossary-push glossary-pull"
    if [[ ${#COMP_WORDS[@]} == 2 ]] ; then
        COMPREPLY=( $(compgen -W "${cmds} --help" -- ${cur}) )
        return 0
    fi
    if [[ ${COMP_WORDS[1]} == '--help' ]] ; then
        COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
        return 0
    fi
    case "${prev}" in
        --config)
            COMPREPLY=( $(compgen -df ${cur}) )
            return 0
            ;;
        --project-config)
            COMPREPLY=( $(compgen -df ${cur}) )
            return 0
            ;;
        --user-config)
            COMPREPLY=( $(compgen -df ${cur}) )
            return 0
            ;;
        --cache-dir)
            COMPREPLY=( $(compgen -d ${cur}) )
            return 0
            ;;
        --src-dir)
            COMPREPLY=( $(compgen -d ${cur}) )
            return 0
            ;;
        --trans-dir)
            COMPREPLY=( $(compgen -d ${cur}) )
            return 0
            ;;
        --source-checkout-url)
            COMPREPLY=( $(compgen -A hostname ${cur}) )
            return 0
            ;;
        --source-view-url)
            COMPREPLY=( $(compgen -A hostname ${cur}) )
            return 0
            ;;
        --url)
            COMPREPLY=( $(compgen -A hostname ${cur}) )
            return 0
            ;;
    esac
    case "${base}" in
        glossary-delete)
            local glossary-delete_opts="--all --id --project --config --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${glossary-delete_opts}" -- ${cur}) )
            return 0
            ;;
        glossary-pull)
            local glossary-pull_opts="--trans-lang --file-type --project --config --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${glossary-pull_opts}" -- ${cur}) )
            return 0
            ;;
        glossary-push)
            local glossary-push_opts="--trans-lang --batch-size --file --project --config --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${glossary-push_opts}" -- ${cur}) )
            return 0
            ;;
        init)
            local init_opts="--src-dir --trans-dir --project-version --project --project-config --includes --excludes --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${init_opts}" -- ${cur}) )
            return 0
            ;;
        list-remote)
            local list-remote_opts="--src-dir --trans-dir --project-version --project --project-config --includes --excludes --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${list-remote_opts}" -- ${cur}) )
            return 0
            ;;
        pull)
            local pull_opts="--locales --pull-type --create-skeletons --encode-tabs --include-fuzzy --continue-after-error --min-doc-percent --use-cache --purge-cache --cache-dir --from-doc --dry-run --src-dir --trans-dir --project-version --project --project-config --includes --excludes --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${pull_opts}" -- ${cur}) )
            return 0
            ;;
        push)
            local push_opts="--locales --src-lang --copy-trans --merge-type --push-type --default-excludes --chunk-size --file-types --list-file-types --exclude-locale-filenames --my-trans --case-sensitive --validate --from-doc --dry-run --src-dir --trans-dir --project-version --project --project-config --includes --excludes --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${push_opts}" -- ${cur}) )
            return 0
            ;;
        put-project)
            local put-project_opts="--project-slug --project-name --project-desc --source-view-url --source-checkout-url --default-project-type --project-status --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${put-project_opts}" -- ${cur}) )
            return 0
            ;;
        put-user)
            local put-user_opts="--user-email --user-username --user-passwordhash --user-key --user-langs --user-roles --user-enabled --user-name --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${put-user_opts}" -- ${cur}) )
            return 0
            ;;
        put-version)
            local put-version_opts="--version-project --version-status --version-slug --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${put-version_opts}" -- ${cur}) )
            return 0
            ;;
        stats)
            local stats_opts="--details --word --docid --format --src-dir --trans-dir --project-version --project --project-config --includes --excludes --project-type --user-config --log-http --disable-ssl-cert --key --url --username --help --quiet --batch-mode --debug --errors"
            COMPREPLY=( $(compgen -W "${stats_opts}" -- ${cur}) )
            return 0
            ;;
    esac
}
complete -F _zanata zanata-cli