diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/find | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/find')
-rw-r--r-- | completions/find | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/completions/find b/completions/find index 64121ed..92c7fa8 100644 --- a/completions/find +++ b/completions/find @@ -2,53 +2,53 @@ # This makes heavy use of ksh style extended globs and contains Linux specific # code for completing the parameter to the -fstype option. -_find() +_comp_cmd_find() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return local i - for i in ${!words[*]}; do + for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(exec|ok)?(dir) ]]; then - _command_offset $((i + 1)) + _comp_command_offset $((i + 1)) return fi done case $prev in -maxdepth | -mindepth) - COMPREPLY=($(compgen -W '{0..9}' -- "$cur")) + _comp_compgen -- -W '{0..9}' return ;; -newer | -anewer | -cnewer | -fls | -fprint | -fprint0 | -fprintf | -name | -[il]name | \ -ilname | -wholename | -[il]wholename | -samefile) - _filedir + _comp_compgen_filedir return ;; -fstype) - _fstypes + _comp_compgen_fstypes [[ $OSTYPE == *bsd* ]] && - COMPREPLY+=($(compgen -W 'local rdonly' -- "$cur")) + _comp_compgen -a -- -W 'local rdonly' return ;; -gid) - _gids + _comp_compgen_gids return ;; -group) - COMPREPLY=($(compgen -g -- "$cur" 2>/dev/null)) + _comp_compgen -- -g return ;; -xtype | -type) - COMPREPLY=($(compgen -W 'b c d p f l s' -- "$cur")) + _comp_compgen -- -W 'b c d p f l s' return ;; -uid) - _uids + _comp_compgen_uids return ;; -user) - COMPREPLY=($(compgen -u -- "$cur")) + _comp_compgen -- -u return ;; -[acm]min | -[acm]time | -inum | -path | -ipath | -regex | -iregex | -links | -perm | \ @@ -57,35 +57,34 @@ _find() return ;; -regextype) - COMPREPLY=($(compgen -W 'emacs posix-awk posix-basic posix-egrep - posix-extended' -- "$cur")) + _comp_compgen -- -W 'emacs posix-awk posix-basic posix-egrep + posix-extended' return ;; esac - local i exprfound=false + local i exprfound="" # set exprfound to true if there is already an expression present for i in "${words[@]}"; do - [[ $i == [-\(\),\!]* ]] && exprfound=true && break + [[ $i == [-\(\),\!]* ]] && exprfound=set && break done # handle case where first parameter is not a dash option - if ! $exprfound && [[ $cur != [-\(\),\!]* ]]; then - _filedir -d + if [[ ! $exprfound && $cur != [-\(\),\!]* ]]; then + _comp_compgen_filedir -d return fi # complete using basic options - COMPREPLY=($(compgen -W '-daystart -depth -follow -help - -ignore_readdir_race -maxdepth -mindepth -mindepth -mount - -noignore_readdir_race -noleaf -regextype -version -warn -nowarn -xdev - -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false - -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename - -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm - -readable -regex -samefile -size -true -type -uid -used -user - -wholename -writable -xtype -context -delete -exec -execdir -fls - -fprint -fprint0 -fprintf -ls -ok -okdir -print -print0 -printf -prune - -quit' -- "$cur")) + _comp_compgen -- -W '-daystart -depth -follow -help -ignore_readdir_race + -maxdepth -mindepth -mindepth -mount -noignore_readdir_race -noleaf + -regextype -version -warn -nowarn -xdev -amin -anewer -atime -cmin + -cnewer -ctime -empty -executable -false -fstype -gid -group -ilname + -iname -inum -ipath -iregex -iwholename -links -lname -mmin -mtime + -name -newer -nogroup -nouser -path -perm -readable -regex -samefile + -size -true -type -uid -used -user -wholename -writable -xtype -context + -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir + -print -print0 -printf -prune -quit' if ((${#COMPREPLY[@]} != 0)); then # this removes any options from the list of completions that have @@ -100,14 +99,14 @@ _find() for i in "${words[@]}"; do [[ $i && -v onlyonce["$i"] ]] || continue for j in "${!COMPREPLY[@]}"; do - [[ ${COMPREPLY[j]} == "$i" ]] && unset 'COMPREPLY[j]' + [[ ${COMPREPLY[j]} == "$i" ]] && unset -v 'COMPREPLY[j]' done done fi - _filedir + _comp_compgen -a filedir } && - complete -F _find find + complete -F _comp_cmd_find find # ex: filetype=sh |