# bash completion for xind
#
# Only the flags the binary actually honours are offered. -s, -p, -e and -g
# parse and are then refused, so completing them would be advertising an
# interface that exits 1.
_xind() {
    local cur prev
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    case "$prev" in
        -c)
            COMPREPLY=( $(compgen -f -- "$cur") )
            return 0
            ;;
    esac

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $(compgen -W '-h -v -V -t -T -q -c' -- "$cur") )
        return 0
    fi

    COMPREPLY=( $(compgen -f -- "$cur") )
}
complete -F _xind xind
