#compdef uu-cp

autoload -U is-at-least

_uu-cp() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'(-T --no-target-directory)-t+[copy all SOURCE arguments into target-directory]:target-directory:_files -/' \
'(-T --no-target-directory)--target-directory=[copy all SOURCE arguments into target-directory]:target-directory:_files -/' \
'--backup=[make a backup of each existing destination file]:CONTROL: ' \
'-S+[override the usual backup suffix]:SUFFIX: ' \
'--suffix=[override the usual backup suffix]:SUFFIX: ' \
'--reflink=[control clone/CoW copies. See below]:WHEN: ' \
'*--preserve=[Preserve the specified attributes (default: mode, ownership (unix only), timestamps), if possible additional attributes: context, links, xattr, all]:ATTR_LIST:(mode ownership timestamps links xattr all)' \
'--no-preserve=[don'\''t preserve the specified attributes]:ATTR_LIST: ' \
'--sparse=[NotImplemented: control creation of sparse files. See below]:WHEN: ' \
'--context=[NotImplemented: set SELinux security context of destination file to default type]:CTX: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'(-t --target-directory)-T[Treat DEST as a regular file and not a directory]' \
'(-t --target-directory)--no-target-directory[Treat DEST as a regular file and not a directory]' \
'-i[ask before overwriting files]' \
'--interactive[ask before overwriting files]' \
'-l[hard-link files instead of copying]' \
'--link[hard-link files instead of copying]' \
'-n[don'\''t overwrite a file that already exists]' \
'--no-clobber[don'\''t overwrite a file that already exists]' \
'-r[copy directories recursively]' \
'--recursive[copy directories recursively]' \
'-R[same as -r]' \
'--strip-trailing-slashes[remove any trailing slashes from each SOURCE argument]' \
'-v[explicitly state what is being done]' \
'--verbose[explicitly state what is being done]' \
'-s[make symbolic links instead of copying]' \
'--symbolic-link[make symbolic links instead of copying]' \
'-f[if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used). Currently not implemented for Windows.]' \
'--force[if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used). Currently not implemented for Windows.]' \
'--remove-destination[remove each existing destination file before attempting to open it (contrast with --force). On Windows, currently only works for writeable files.]' \
'-b[like --backup but does not accept an argument]' \
'-u[copy only when the SOURCE file is newer than the destination file or when the destination file is missing]' \
'--update[copy only when the SOURCE file is newer than the destination file or when the destination file is missing]' \
'--attributes-only[Don'\''t copy the file data, just the attributes]' \
'-p[same as --preserve=mode,ownership(unix only),timestamps]' \
'--preserve-default-attributes[same as --preserve=mode,ownership(unix only),timestamps]' \
'--parents[use full source file name under DIRECTORY]' \
'-P[never follow symbolic links in SOURCE]' \
'--no-dereference[never follow symbolic links in SOURCE]' \
'-L[always follow symbolic links in SOURCE]' \
'--dereference[always follow symbolic links in SOURCE]' \
'-a[Same as -dR --preserve=all]' \
'--archive[Same as -dR --preserve=all]' \
'-d[same as --no-dereference --preserve=links]' \
'-x[stay on this file system]' \
'--one-file-system[stay on this file system]' \
'--copy-contents[NotImplemented: copy contents of special files when recursive]' \
'-H[NotImplemented: follow command-line symbolic links in SOURCE]' \
'*::paths:_files' \
&& ret=0
}

(( $+functions[_uu-cp_commands] )) ||
_uu-cp_commands() {
    local commands; commands=()
    _describe -t commands 'uu-cp commands' commands "$@"
}

_uu-cp "$@"
