summaryrefslogtreecommitdiffstats
path: root/completions/timeout
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf2621414ee5f2f601424c22f00e207903e3b6104 (patch)
tree56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/timeout
parentAdding debian version 1:2.11-8. (diff)
downloadbash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz
bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/timeout')
-rw-r--r--completions/timeout35
1 files changed, 17 insertions, 18 deletions
diff --git a/completions/timeout b/completions/timeout
index 32ff2e3..f5115d2 100644
--- a/completions/timeout
+++ b/completions/timeout
@@ -1,39 +1,38 @@
# timeout(1) completion -*- shell-script -*-
-_timeout()
+_comp_cmd_timeout()
{
- local cur prev words cword split i found=false
- _init_completion -s || return
+ local cur prev words cword was_split comp_args i
+ _comp_initialize -s -- "$@" || return
- for ((i = 1; i <= COMP_CWORD; i++)); do
- if [[ ${COMP_WORDS[i]} != -* && ${COMP_WORDS[i - 1]} != = ]]; then
- if $found; then
- _command_offset $i
- return
- fi
- found=true
+ local noargopts='!(-*|*[ks]*)'
+ for ((i = 1; i < cword; i++)); do
+ if [[ ${words[i]} != -* ]]; then
+ _comp_command_offset "$((i + 1))"
+ return
fi
- [[ ${COMP_WORDS[i]} == -@(-kill-after|-signal|!(-*)[ks]) ]] && ((i++))
+ # shellcheck disable=SC2254
+ [[ ${words[i]} == -@(-kill-after|-signal|${noargopts}[ks]) ]] && ((i++))
done
+ # shellcheck disable=SC2254
case $prev in
- --help | --version | --kill-after | -!(-*)k)
+ --help | --version | --kill-after | -${noargopts}k)
return
;;
- --signal | -!(-*)s)
- _signals
+ --signal | -${noargopts}s)
+ _comp_compgen_signals
return
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- local opts=$(_parse_help "$1")
- COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur"))
+ _comp_compgen_help || _comp_compgen_usage
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
fi
} &&
- complete -F _timeout timeout
+ complete -F _comp_cmd_timeout timeout
# ex: filetype=sh