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/pgrep | |
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/pgrep')
-rw-r--r-- | completions/pgrep | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/completions/pgrep b/completions/pgrep index 62dbb65..d4402f5 100644 --- a/completions/pgrep +++ b/completions/pgrep @@ -1,62 +1,60 @@ # pgrep(1) and pkill(1) completion -*- shell-script -*- -_pgrep() +_comp_cmd_pgrep() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[cdgJMNstTzFGPuU]*)' + # shellcheck disable=SC2254 case $prev in - --delimiter | --pgroup | --session | --terminal | -!(-*)[cdgJMNstTz]) + --delimiter | --pgroup | --session | --terminal | -${noargopts}[cdgJMNstTz]) return ;; --signal) - _signals + _comp_compgen_signals return ;; - --pidfile | -!(-*)F) - _filedir + --pidfile | -${noargopts}F) + _comp_compgen_filedir return ;; - --group | -!(-*)G) - _gids + --group | -${noargopts}G) + _comp_compgen_gids return ;; -j) - COMPREPLY=($(compgen -W 'any none' -- "$cur")) + _comp_compgen -- -W 'any none' return ;; - --parent | --ns | -!(-*)P) - _pids + --parent | --ns | -${noargopts}P) + _comp_compgen_pids return ;; - --euid | --uid | -!(-*)[uU]) - _uids + --euid | --uid | -${noargopts}[uU]) + _comp_compgen_uids return ;; --nslist) - local prefix= - [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( - $(IFS="$IFS," compgen -W '$($1 --help 2>&1 | - command sed -ne "s/^[[:space:]]*Available namespaces://p")' \ - -- "${cur##*,}")) - ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) + _comp_compgen -c "${cur##*,}" split -F $' \t\n,' -- "$( + "$1" --help 2>&1 | + command sed -ne 's/^[[:space:]]*Available namespaces://p' + )" && + _comp_delimited , -W '"${COMPREPLY[@]}"' return ;; esac if [[ $cur == -* ]]; then - local help=$(_parse_help "$1") - [[ $help ]] || help='$("$1" --usage 2>&1 | - command sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" | - _parse_usage -)' - COMPREPLY=($(compgen -W "$help" -- "$cur")) - [[ $cword -eq 1 && $1 == *pkill ]] && _signals - + _comp_compgen_help || + _comp_compgen_usage - <<<"$("$1" --usage 2>&1 | + command sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//")" + [[ $cword -eq 1 && $1 == *pkill ]] && _comp_compgen -a signals - return fi - _pnames -s + _comp_compgen_pnames -s } && - complete -F _pgrep pgrep pkill + complete -F _comp_cmd_pgrep pgrep pkill # ex: filetype=sh |