_fd 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #compdef fd fdfind
  2. autoload -U is-at-least
  3. _fd() {
  4. typeset -A opt_args
  5. typeset -a _arguments_options
  6. local ret=1
  7. if is-at-least 5.2; then
  8. _arguments_options=(-s -S -C)
  9. else
  10. _arguments_options=(-s -C)
  11. fi
  12. local context curcontext="$curcontext" state line
  13. _arguments "${_arguments_options[@]}" \
  14. '-d+[Set maximum search depth (default: none)]' \
  15. '--max-depth=[Set maximum search depth (default: none)]' \
  16. '--maxdepth=[See --max-depth]' \
  17. '*-t+[Filter by type: file (f), directory (d), symlink (l),
  18. executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
  19. '*--type=[Filter by type: file (f), directory (d), symlink (l),
  20. executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
  21. '*-e+[Filter by file extension]' \
  22. '*--extension=[Filter by file extension]' \
  23. '-x+[Execute a command for each search result]' \
  24. '--exec=[Execute a command for each search result]' \
  25. '(-x --exec)-X+[Execute a command with all search results at once]' \
  26. '(-x --exec)--exec-batch=[Execute a command with all search results at once]' \
  27. '*-E+[Exclude entries that match the given glob pattern]' \
  28. '*--exclude=[Exclude entries that match the given glob pattern]' \
  29. '*--ignore-file=[Add a custom ignore-file in .gitignore format]' \
  30. '-c+[When to use colors: never, *auto*, always]: :(never auto always)' \
  31. '--color=[When to use colors: never, *auto*, always]: :(never auto always)' \
  32. '-j+[Set number of threads to use for searching & executing]' \
  33. '--threads=[Set number of threads to use for searching & executing]' \
  34. '*-S+[Limit results based on the size of files.]' \
  35. '*--size=[Limit results based on the size of files.]' \
  36. '--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \
  37. '--changed-within=[Filter by file modification time (newer than)]' \
  38. '--changed-before=[Filter by file modification time (older than)]' \
  39. '*--search-path=[(hidden)]' \
  40. '-H[Search hidden files and directories]' \
  41. '--hidden[Search hidden files and directories]' \
  42. '-I[Do not respect .(git|fd)ignore files]' \
  43. '--no-ignore[Do not respect .(git|fd)ignore files]' \
  44. '--no-ignore-vcs[Do not respect .gitignore files]' \
  45. '*-u[Alias for no-ignore and/or hidden]' \
  46. '-s[Case-sensitive search (default: smart case)]' \
  47. '--case-sensitive[Case-sensitive search (default: smart case)]' \
  48. '-i[Case-insensitive search (default: smart case)]' \
  49. '--ignore-case[Case-insensitive search (default: smart case)]' \
  50. '-F[Treat the pattern as a literal string]' \
  51. '--fixed-strings[Treat the pattern as a literal string]' \
  52. '-a[Show absolute instead of relative paths]' \
  53. '--absolute-path[Show absolute instead of relative paths]' \
  54. '-L[Follow symbolic links]' \
  55. '--follow[Follow symbolic links]' \
  56. '-p[Search full path (default: file-/dirname only)]' \
  57. '--full-path[Search full path (default: file-/dirname only)]' \
  58. '-0[Separate results by the null character]' \
  59. '--print0[Separate results by the null character]' \
  60. '--show-errors[Enable display of filesystem errors]' \
  61. '-h[Prints help information]' \
  62. '--help[Prints help information]' \
  63. '-V[Prints version information]' \
  64. '--version[Prints version information]' \
  65. '::pattern -- the search pattern, a regular expression (optional):_files' \
  66. '::path -- the root directory for the filesystem search (optional):_files' \
  67. && ret=0
  68. }
  69. (( $+functions[_fd_commands] )) ||
  70. _fd_commands() {
  71. local commands; commands=(
  72. )
  73. _describe -t commands 'fd commands' commands "$@"
  74. }
  75. _fd "$@"