summaryrefslogtreecommitdiffstats
path: root/completions/timeout
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/timeout
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/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