summaryrefslogtreecommitdiffstats
path: root/completions/patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/patch
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-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/patch')
-rw-r--r--completions/patch53
1 files changed, 27 insertions, 26 deletions
diff --git a/completions/patch b/completions/patch
index e883d9c..bba184c 100644
--- a/completions/patch
+++ b/completions/patch
@@ -1,70 +1,71 @@
# patch(1) completion -*- shell-script -*-
-_patch()
+_comp_cmd_patch()
{
- local cur prev words cword split
- _init_completion -s || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+ local noargopts='!(-*|*[pDBYzgFiorVd]*)'
+ # shellcheck disable=SC2254
case $prev in
--strip | --ifdef | --prefix | --basename-prefix | --suffix | --get | \
- -!(-*)[pDBYzg])
+ -${noargopts}[pDBYzg])
return
;;
- --fuzz | -!(-*)F)
- COMPREPLY=($(compgen -W '{0..3}' -- "$cur"))
+ --fuzz | -${noargopts}F)
+ _comp_compgen -- -W '{0..3}'
return
;;
- --input | -!(-*)i)
- _filedir '@(?(d)patch|dif?(f))'
+ --input | -${noargopts}i)
+ _comp_compgen_filedir '@(?(d)patch|dif?(f))'
return
;;
- --output | --reject-file | -!(-*)[or])
+ --output | --reject-file | -${noargopts}[or])
[[ ! $cur || $cur == - ]] && COMPREPLY=(-)
- _filedir
+ _comp_compgen -a filedir
return
;;
--quoting-style)
- COMPREPLY=($(compgen -W 'literal shell shell-always c escape' \
- -- "$cur"))
+ _comp_compgen -- -W 'literal shell shell-always c escape'
return
;;
- --version-control | -!(-*)V)
- COMPREPLY=($(compgen -W 'simple numbered existing' -- "$cur"))
+ --version-control | -${noargopts}V)
+ _comp_compgen -- -W 'simple numbered existing'
return
;;
- --directory | -!(-*)d)
- _filedir -d
+ --directory | -${noargopts}d)
+ _comp_compgen_filedir -d
return
;;
--reject-format)
- COMPREPLY=($(compgen -W 'context unified' -- "$cur"))
+ _comp_compgen -- -W 'context unified'
return
;;
--read-only)
- COMPREPLY=($(compgen -W 'ignore warn fail' -- "$cur"))
+ _comp_compgen -- -W 'ignore warn fail'
return
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
return
fi
- local args
- _count_args
- case $args in
+ local REPLY
+ _comp_count_args
+ case $REPLY in
1)
- _filedir
+ _comp_compgen_filedir
;;
2)
- _filedir '@(?(d)patch|dif?(f))'
+ _comp_compgen_filedir '@(?(d)patch|dif?(f))'
;;
esac
} &&
- complete -F _patch patch
+ complete -F _comp_cmd_patch patch
# ex: filetype=sh