Add documentation and zsh updates

- Include --and in man page and zsh completions.
- Include --no-require-git and --changed-after to zsh completions

Fixes: #1282
This commit is contained in:
Thayne McCombs 2023-03-21 00:43:44 -06:00
parent bae0a1bfa6
commit 399bf3a931
2 changed files with 14 additions and 1 deletions

View File

@ -36,7 +36,7 @@ _fd() {
# for all of the potential negation options listed below! # for all of the potential negation options listed below!
if if
# (--[bpsu]* => match all options marked with '$no') # (--[bpsu]* => match all options marked with '$no')
[[ $PREFIX$SUFFIX == --[bopsu]* ]] || [[ $PREFIX$SUFFIX == --[bopsun]* ]] ||
zstyle -t ":complete:$curcontext:*" complete-all zstyle -t ":complete:$curcontext:*" complete-all
then then
no= no=
@ -70,6 +70,9 @@ _fd() {
{-g,--glob}'[perform a glob-based search]' {-g,--glob}'[perform a glob-based search]'
{-F,--fixed-strings}'[treat pattern as literal string instead of a regex]' {-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
+ '(no-require-git)'
"$no(no-ignore-full --no-ignore-vcs --no-require-git)--no-require-git[don't require git repo to respect gitignores]"
+ '(match-full)' # match against full path + '(match-full)' # match against full path
{-p,--full-path}'[match the pattern against the full path instead of the basename]' {-p,--full-path}'[match the pattern against the full path instead of the basename]'
@ -118,6 +121,7 @@ _fd() {
+ '(filter-mtime-newer)' # filter by files modified after than + '(filter-mtime-newer)' # filter by files modified after than
'--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration' '--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
'--changed-after=[alias for --changed-within]:date/duration'
'!--change-newer-than=:date/duration' '!--change-newer-than=:date/duration'
'!--newer=:date/duration' '!--newer=:date/duration'
@ -158,6 +162,10 @@ _fd() {
+ strip-cwd-prefix + strip-cwd-prefix
$no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]' $no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]'
+ and
'--and=[additional required search path]:pattern'
+ args # positional arguments + args # positional arguments
'1: :_guard "^-*" pattern' '1: :_guard "^-*" pattern'
'(--search-path)*:directory:_files -/' '(--search-path)*:directory:_files -/'

5
doc/fd.1 vendored
View File

@ -102,6 +102,11 @@ Perform a regular-expression based search (default). This can be used to overrid
Treat the pattern as a literal string instead of a regular expression. Note that this also Treat the pattern as a literal string instead of a regular expression. Note that this also
performs substring comparison. If you want to match on an exact filename, consider using '\-\-glob'. performs substring comparison. If you want to match on an exact filename, consider using '\-\-glob'.
.TP .TP
.BI "\-\-and " pattern
Add additional required search patterns, all of which must be matched. Multiple additional
patterns can be specified. The patterns are regular expressions, unless '\-\-glob'
or '\-\-fixed\-strings' is used.
.TP
.B \-a, \-\-absolute\-path .B \-a, \-\-absolute\-path
Shows the full path starting from the root as opposed to relative paths. Shows the full path starting from the root as opposed to relative paths.
The flag can be overridden with '--relative-path'. The flag can be overridden with '--relative-path'.