_uu-sort() {
    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
            uu-sort)
                cmd="uu-sort"
                ;;
            
            *)
                ;;
        esac
    done

    case "${cmd}" in
        uu-sort)
            opts=" -h -M -n -g -V -R -d -m -C -f -i -b -r -s -u -z -c -o -k -t -S -T  --human-numeric-sort --month-sort --numeric-sort --general-numeric-sort --version-sort --random-sort --dictionary-order --merge --check-silent --ignore-case --ignore-nonprinting --ignore-leading-blanks --reverse --stable --unique --zero-terminated --debug --help --version --sort --check --output --key --field-separator --parallel --buffer-size --temporary-directory --compress-program --batch-size --files0-from  <files>... "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --sort)
                    COMPREPLY=($(compgen -W "general-numeric human-numeric month numeric version random" -- "${cur}"))
                    return 0
                    ;;
                --check)
                    COMPREPLY=($(compgen -W "silent quiet diagnose-first" -- "${cur}"))
                    return 0
                    ;;
                    -c)
                    COMPREPLY=($(compgen -W "silent quiet diagnose-first" -- "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -o)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -k)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --field-separator)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -t)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --parallel)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --buffer-size)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -S)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --temporary-directory)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -T)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --compress-program)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --batch-size)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --files0-from)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        
    esac
}

complete -F _uu-sort -o bashdefault -o default uu-sort
