From 399bf3a9317b63f37f3b872d7e35d94b81fc5170 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 21 Mar 2023 00:43:44 -0600 Subject: [PATCH] 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 --- contrib/completion/_fd | 10 +++++++++- doc/fd.1 | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/contrib/completion/_fd b/contrib/completion/_fd index 53c0a7c..b00f897 100644 --- a/contrib/completion/_fd +++ b/contrib/completion/_fd @@ -36,7 +36,7 @@ _fd() { # for all of the potential negation options listed below! if # (--[bpsu]* => match all options marked with '$no') - [[ $PREFIX$SUFFIX == --[bopsu]* ]] || + [[ $PREFIX$SUFFIX == --[bopsun]* ]] || zstyle -t ":complete:$curcontext:*" complete-all then no= @@ -70,6 +70,9 @@ _fd() { {-g,--glob}'[perform a glob-based search]' {-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 {-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 '--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' '!--newer=:date/duration' @@ -158,6 +162,10 @@ _fd() { + strip-cwd-prefix $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 '1: :_guard "^-*" pattern' '(--search-path)*:directory:_files -/' diff --git a/doc/fd.1 b/doc/fd.1 index 6df0ef0..7b0180f 100644 --- a/doc/fd.1 +++ b/doc/fd.1 @@ -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 performs substring comparison. If you want to match on an exact filename, consider using '\-\-glob'. .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 Shows the full path starting from the root as opposed to relative paths. The flag can be overridden with '--relative-path'.