#compdef et

autoload -U is-at-least

_et() {
    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[@]}" \
'-d+[Print physical or logical file size]:DISK_USAGE:((logical\:"How many bytes does a file contain"
physical\:"How much actual space on disk, taking into account sparse files and compression"))' \
'--disk-usage=[Print physical or logical file size]:DISK_USAGE:((logical\:"How many bytes does a file contain"
physical\:"How much actual space on disk, taking into account sparse files and compression"))' \
'--time=[Which kind of timestamp to use; modified by default]:TIME:((created\:"Timestamp showing when the file was created"
accessed\:"Timestamp showing when the file was last accessed"
modified\:"Timestamp showing when the file was last modified"))' \
'-L+[Maximum depth to display]:NUM: ' \
'--level=[Maximum depth to display]:NUM: ' \
'-p+[Regular expression (or glob if '\''--glob'\'' or '\''--iglob'\'' is used) used to match files]:PATTERN: ' \
'--pattern=[Regular expression (or glob if '\''--glob'\'' or '\''--iglob'\'' is used) used to match files]:PATTERN: ' \
'-t+[Restrict regex or glob search to a particular file-type]:FILE_TYPE:((file\:"A regular file"
dir\:"A directory"
link\:"A symlink"))' \
'--file-type=[Restrict regex or glob search to a particular file-type]:FILE_TYPE:((file\:"A regular file"
dir\:"A directory"
link\:"A symlink"))' \
'-s+[Sort-order to display directory content]:SORT:((name\:"Sort entries by file name"
size\:"Sort entries by size smallest to largest, top to bottom"
size-rev\:"Sort entries by size largest to smallest, bottom to top"))' \
'--sort=[Sort-order to display directory content]:SORT:((name\:"Sort entries by file name"
size\:"Sort entries by size smallest to largest, top to bottom"
size-rev\:"Sort entries by size largest to smallest, bottom to top"))' \
'-T+[Number of threads to use]:THREADS: ' \
'--threads=[Number of threads to use]:THREADS: ' \
'-u+[Report disk usage in binary or SI units]:UNIT:((bin\:"Displays disk usage using binary prefixes"
si\:"Displays disk usage using SI prefixes"))' \
'--unit=[Report disk usage in binary or SI units]:UNIT:((bin\:"Displays disk usage using binary prefixes"
si\:"Displays disk usage using SI prefixes"))' \
'--completions=[Print completions for a given shell to stdout]:COMPLETIONS:(bash elvish fish powershell zsh)' \
'-C[Turn on colorization always]' \
'--force-color[Turn on colorization always]' \
'-f[Follow symlinks]' \
'--follow[Follow symlinks]' \
'-F[Print disk usage information in plain format without the ASCII tree]' \
'--flat[Print disk usage information in plain format without the ASCII tree]' \
'-H[Print disk usage in human-readable format]' \
'--human[Print disk usage in human-readable format]' \
'-i[Do not respect .gitignore files]' \
'--no-ignore[Do not respect .gitignore files]' \
'-I[Display file icons]' \
'--icons[Display file icons]' \
'-l[Show extended metadata and attributes]' \
'--long[Show extended metadata and attributes]' \
'--octal[Show permissions in numeric octal format instead of symbolic]' \
'--glob[Enables glob based searching]' \
'--iglob[Enables case-insensitive glob based searching]' \
'-P[Remove empty directories from output]' \
'--prune[Remove empty directories from output]' \
'--dirs-first[Sort directories above files]' \
'-.[Show hidden files]' \
'--hidden[Show hidden files]' \
'--no-git[Disable traversal of .git directory when traversing hidden files]' \
'--dirs-only[Only print directories]' \
'--inverted[Print tree with the root directory at the topmost position]' \
'--no-color[Print plainly without ANSI escapes]' \
'--no-config[Don'\''t read configuration file]' \
'--suppress-size[Omit disk usage from output]' \
'--truncate[Truncate output to fit terminal emulator window]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::dir -- Directory to traverse; defaults to current working directory:_files' \
&& ret=0
}

(( $+functions[_et_commands] )) ||
_et_commands() {
    local commands; commands=()
    _describe -t commands 'et commands' commands "$@"
}

if [ "$funcstack[1]" = "_et" ]; then
    _et "$@"
else
    compdef _et et
fi
