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

    case "${cmd}" in
        uu-cp)
            opts=" -T -i -l -n -r -R -v -s -f -b -u -p -P -L -a -d -x -H -h -V -t -S  --no-target-directory --interactive --link --no-clobber --recursive --strip-trailing-slashes --verbose --symbolic-link --force --remove-destination --update --attributes-only --preserve-default-attributes --parents --no-dereference --dereference --archive --one-file-system --copy-contents --help --version --target-directory --backup --suffix --reflink --preserve --no-preserve --sparse --context  <paths>... "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --target-directory)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -t)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --backup)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --suffix)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -S)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reflink)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --preserve)
                    COMPREPLY=($(compgen -W "mode ownership timestamps links xattr all" -- "${cur}"))
                    return 0
                    ;;
                --no-preserve)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sparse)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --context)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        
    esac
}

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