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/chronyc | |
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/chronyc')
-rw-r--r-- | completions/chronyc | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/completions/chronyc b/completions/chronyc index e6bb8e9..15a784b 100644 --- a/completions/chronyc +++ b/completions/chronyc @@ -1,34 +1,36 @@ # chronyc(1) completion -*- shell-script -*- -_chronyc_command_args() +_comp_cmd_chronyc__command_args() { local -a args - args=($(compgen -W "$($1 help 2>/dev/null | - awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }')")) + _comp_split args "$("$1" help 2>/dev/null | + _comp_awk '/^'"$prev"'[ \t][^ []/ { gsub("\\|", " ", $2); print $2 }')" case $args in - \<address\>) _known_hosts_real -- "$cur" ;; + \<address\>) _comp_compgen_known_hosts -- "$cur" ;; \<*) ;; - *) COMPREPLY+=($(compgen -W '${args[@]}' -- "$cur")) ;; + *) ((${#args[@]})) && + _comp_compgen -a -- -W '"${args[@]}"' ;; esac } -_chronyc() +_comp_cmd_chronyc() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in --help | -*p) return ;; -*h) - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1") -6' -- "$cur")) + _comp_compgen_usage + _comp_compgen -a -- -W '-6' return fi @@ -40,22 +42,21 @@ _chronyc() case $args in 0) - COMPREPLY=($(compgen -W "$($1 help 2>/dev/null | - awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" \ - -- "$cur")) + _comp_compgen_split -- "$("$1" help 2>/dev/null | + _comp_awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" ;; 1) - _chronyc_command_args "$1" + _comp_cmd_chronyc__command_args "$1" if [[ ! ${COMPREPLY-} && $prev == sources?(tats) ]]; then - # [-v] not handled by _chronyc_command_args yet - COMPREPLY=($(compgen -W '-v' -- "$cur")) + # [-v] not handled by _comp_cmd_chronyc__command_args yet + _comp_compgen -- -W '-v' fi ;; 2) - [[ $prev == @(peer|server) ]] && _known_hosts_real -- "$cur" + [[ $prev == @(peer|server) ]] && _comp_compgen_known_hosts -- "$cur" ;; esac } && - complete -F _chronyc chronyc + complete -F _comp_cmd_chronyc chronyc # ex: filetype=sh |