#compdef fdfind

autoload -U is-at-least

_fdfind() {
    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+[Set maximum search depth (default: none)]' \
'--max-depth=[Set maximum search depth (default: none)]' \
'--maxdepth=[Set maximum search depth (default: none)]' \
'--min-depth=[Only show results starting at given depth]' \
'(-d --max-depth --min-depth)--exact-depth=[Only show results at exact given depth]' \
'*-t+[Filter by type: file (f), directory (d), symlink (l),
executable (x), empty (e), socket (s), pipe (p)]: :(f file d directory l symlink x executable e empty s socket p pipe)' \
'*--type=[Filter by type: file (f), directory (d), symlink (l),
executable (x), empty (e), socket (s), pipe (p)]: :(f file d directory l symlink x executable e empty s socket p pipe)' \
'*-e+[Filter by file extension]' \
'*--extension=[Filter by file extension]' \
'(-l --list-details)-x+[Execute a command for each search result]' \
'(-l --list-details)--exec=[Execute a command for each search result]' \
'(-x --exec -l --list-details)-X+[Execute a command with all search results at once]' \
'(-x --exec -l --list-details)--exec-batch=[Execute a command with all search results at once]' \
'--batch-size=[Max number of arguments to run as a batch with -X]' \
'*-E+[Exclude entries that match the given glob pattern]' \
'*--exclude=[Exclude entries that match the given glob pattern]' \
'*--ignore-file=[Add custom ignore-file in '\''.gitignore'\'' format]' \
'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \
'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \
'-j+[Set number of threads]' \
'--threads=[Set number of threads]' \
'*-S+[Limit results based on the size of files]' \
'*--size=[Limit results based on the size of files]' \
'--max-buffer-time=[Milliseconds to buffer before streaming search results to console]' \
'--changed-within=[Filter by file modification time (newer than)]' \
'--changed-before=[Filter by file modification time (older than)]' \
'(-x --exec -X --exec-batch -l --list-details)--max-results=[Limit number of search results]' \
'--base-directory=[Change current working directory]' \
'--path-separator=[Set path separator when printing file paths]' \
'*--search-path=[Provide paths to search as an alternative to the positional <path>]' \
'-o+[Filter by owning user and/or group]' \
'--owner=[Filter by owning user and/or group]' \
'-H[Search hidden files and directories]' \
'--hidden[Search hidden files and directories]' \
'--no-hidden[]' \
'-I[Do not respect .(git|fd)ignore files]' \
'--no-ignore[Do not respect .(git|fd)ignore files]' \
'--ignore[]' \
'--no-ignore-vcs[Do not respect .gitignore files]' \
'--ignore-vcs[]' \
'--no-ignore-parent[Do not respect .(git|fd)ignore files in parent directories]' \
'--no-global-ignore-file[Do not respect the global ignore file]' \
'*-u[Alias for '\''--no-ignore'\'', and '\''--hidden'\'' when given twice]' \
'*--unrestricted[Alias for '\''--no-ignore'\'', and '\''--hidden'\'' when given twice]' \
'-s[Case-sensitive search (default: smart case)]' \
'--case-sensitive[Case-sensitive search (default: smart case)]' \
'-i[Case-insensitive search (default: smart case)]' \
'--ignore-case[Case-insensitive search (default: smart case)]' \
'(-F --fixed-strings)-g[Glob-based search (default: regular expression)]' \
'(-F --fixed-strings)--glob[Glob-based search (default: regular expression)]' \
'--regex[Regular-expression based search (default)]' \
'-F[Treat pattern as literal string instead of regex]' \
'--fixed-strings[Treat pattern as literal string instead of regex]' \
'-a[Show absolute instead of relative paths]' \
'--absolute-path[Show absolute instead of relative paths]' \
'--relative-path[]' \
'(-a --absolute-path)-l[Use a long listing format with file metadata]' \
'(-a --absolute-path)--list-details[Use a long listing format with file metadata]' \
'-L[Follow symbolic links]' \
'--follow[Follow symbolic links]' \
'--no-follow[]' \
'-p[Search full abs. path (default: filename only)]' \
'--full-path[Search full abs. path (default: filename only)]' \
'(-l --list-details)-0[Separate results by the null character]' \
'(-l --list-details)--print0[Separate results by the null character]' \
'(-S --size --exact-depth)--prune[Do not traverse into matching directories]' \
'(-x --exec -X --exec-batch -l --list-details)-1[Limit search to a single result]' \
'(-x --exec -X --exec-batch -l --list-details --max-results)-q[Print nothing, exit code 0 if match found, 1 otherwise]' \
'(-x --exec -X --exec-batch -l --list-details --max-results)--quiet[Print nothing, exit code 0 if match found, 1 otherwise]' \
'--show-errors[Show filesystem errors]' \
'(--search-path)--strip-cwd-prefix[strip '\''./'\'' prefix from non-tty outputs]' \
'--one-file-system[Do not descend into a different file system]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::pattern -- the search pattern (a regular expression, unless '--glob' is used; optional):_files' \
'::path -- the root directory for the filesystem search (optional):_files' \
&& ret=0
    
}

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

_fdfind "$@"