summaryrefslogtreecommitdiffstats
path: root/completions/chronyc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf2621414ee5f2f601424c22f00e207903e3b6104 (patch)
tree56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/chronyc
parentAdding debian version 1:2.11-8. (diff)
downloadbash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz
bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.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/chronyc37
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