_girouette() {
    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
            girouette)
                cmd="girouette"
                ;;
            
            *)
                ;;
        esac
    done

    case "${cmd}" in
        girouette)
            opts=" -V -v -q -h -k -l -c -L -u  --clean-cache --print-default-config --version --verbose --quiet --help --key --location --config --cache --language --units  "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -k)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --location)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -l)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --config)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cache)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -c)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --language)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -L)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --units)
                    COMPREPLY=($(compgen -W "metric imperial standard" -- "${cur}"))
                    return 0
                    ;;
                    -u)
                    COMPREPLY=($(compgen -W "metric imperial standard" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        
    esac
}

complete -F _girouette -o bashdefault -o default girouette
