summaryrefslogtreecommitdiffstats
path: root/completions/kill
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--completions/kill21
-rw-r--r--completions/killall28
2 files changed, 26 insertions, 23 deletions
diff --git a/completions/kill b/completions/kill
index 25cddba..266ea13 100644
--- a/completions/kill
+++ b/completions/kill
@@ -1,29 +1,30 @@
# kill(1) completion -*- shell-script -*-
-_kill()
+_comp_cmd_kill()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -- "$@" || return
case $prev in
-s)
- _signals
+ _comp_compgen_signals
return
;;
- -l)
+ -l | -n)
return
;;
esac
if [[ $cword -eq 1 && $cur == -* ]]; then
# return list of available signals
- _signals -
- COMPREPLY+=($(compgen -W "-s -l" -- "$cur"))
+ _comp_compgen_signals -
+ _comp_compgen -a help -c help "$1"
else
- # return list of available PIDs
- _pids
+ # return list of available PIDs and jobs
+ _comp_compgen_pids
+ _comp_compgen -ac "${cur#%}" -- -j -P %
fi
} &&
- complete -F _kill kill
+ complete -F _comp_cmd_kill kill
# ex: filetype=sh
diff --git a/completions/killall b/completions/killall
index c7c0b0f..76f8759 100644
--- a/completions/killall
+++ b/completions/killall
@@ -2,35 +2,37 @@
[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1
-_killall()
+_comp_cmd_killall()
{
- 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='!(-*|*[Zoysu]*)'
+ # shellcheck disable=SC2254
case $prev in
- --context | --older-than | --younger-than | --version | -!(-*)@([Zoy]|V*))
+ --context | --older-than | --younger-than | --version | -${noargopts}@([Zoy]|V*))
return
;;
- --signal | -!(-*)s)
- _signals
+ --signal | -${noargopts}s)
+ _comp_compgen_signals
return
;;
- --user | -!(-*)u)
- _allowed_users
+ --user | -${noargopts}u)
+ _comp_compgen_allowed_users
return
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
- ((cword == 1)) && _signals -
+ _comp_compgen_help
+ ((cword == 1)) && _comp_compgen -a signals -
return
fi
- _pnames
+ _comp_compgen_pnames
} &&
- complete -F _killall killall
+ complete -F _comp_cmd_killall killall
# ex: filetype=sh