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/update-rc.d | |
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/update-rc.d')
-rw-r--r-- | completions/update-rc.d | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/completions/update-rc.d b/completions/update-rc.d index 9b281d5..a5040d4 100644 --- a/completions/update-rc.d +++ b/completions/update-rc.d @@ -2,57 +2,57 @@ # # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> -_update_rc_d() +_comp_cmd_update_rc_d() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return local sysvdir services options [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d - services=($(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob))) - services=(${services[@]#$sysvdir/}) + _comp_expand_glob services '"$sysvdir"/!(README*|*.sh|$_comp_backup_glob)' && + services=("${services[@]#$sysvdir/}") options=(-f -n) if [[ $cword -eq 1 || $prev == -* ]]; then - COMPREPLY=($(compgen -W '${options[@]} ${services[@]}' \ - -X '$(tr " " "|" <<<${words[@]})' -- "$cur")) - elif [[ $prev == ?($(tr " " "|" <<<"${services[*]}")) ]]; then - COMPREPLY=($(compgen -W 'remove defaults start stop' -- "$cur")) + _comp_compgen -- -W '"${options[@]}" ${services[@]+"${services[@]}"}' \ + -X '$(tr " " "|" <<<${words[@]})' + elif ((${#services[@]})) && [[ $prev == ?($(tr " " "|" <<<"${services[*]}")) ]]; then + _comp_compgen -- -W 'remove defaults start stop' elif [[ $prev == defaults && $cur == [0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) elif [[ $prev == defaults && $cur == [sk]?([0-9]) ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) - elif [[ $prev == defaults && -z $cur ]]; then + elif [[ $prev == defaults && ! $cur ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9 s k) elif [[ $prev == ?(start|stop) ]]; then - if [[ $cur == [0-9] || -z $cur ]]; then + if [[ $cur == [0-9] || ! $cur ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) elif [[ $cur == [0-9][0-9] ]]; then - COMPREPLY=($cur) + COMPREPLY=("$cur") else COMPREPLY=() fi elif [[ $prev == ?([0-9][0-9]|[0-6S]) ]]; then - if [[ -z $cur ]]; then + if [[ ! $cur ]]; then if [[ $prev == [0-9][0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 S) else COMPREPLY=(0 1 2 3 4 5 6 S .) fi elif [[ $cur == [0-6S.] ]]; then - COMPREPLY=($cur) + COMPREPLY=("$cur") else COMPREPLY=() fi elif [[ $prev == "." ]]; then - COMPREPLY=($(compgen -W "start stop" -- "$cur")) + _comp_compgen -- -W "start stop" else COMPREPLY=() fi } && - complete -F _update_rc_d update-rc.d + complete -F _comp_cmd_update_rc_d update-rc.d # ex: filetype=sh |