summaryrefslogtreecommitdiff
path: root/completions/chronyc
diff options
context:
space:
mode:
Diffstat (limited to 'completions/chronyc')
-rw-r--r--completions/chronyc28
1 files changed, 15 insertions, 13 deletions
diff --git a/completions/chronyc b/completions/chronyc
index a59746aa..e6bb8e9d 100644
--- a/completions/chronyc
+++ b/completions/chronyc
@@ -2,12 +2,13 @@
_chronyc_command_args()
{
- local -a args=( $(compgen -W "$($1 help 2>/dev/null | \
- awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }')") )
+ local -a args
+ args=($(compgen -W "$($1 help 2>/dev/null |
+ awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }')"))
case $args in
\<address\>) _known_hosts_real -- "$cur" ;;
\<*) ;;
- *) COMPREPLY+=( $(compgen -W '${args[@]}' -- "$cur") ) ;;
+ *) COMPREPLY+=($(compgen -W '${args[@]}' -- "$cur")) ;;
esac
}
@@ -17,7 +18,7 @@ _chronyc()
_init_completion || return
case $prev in
- --help|-*p)
+ --help | -*p)
return
;;
-*h)
@@ -27,26 +28,27 @@ _chronyc()
esac
if [[ $cur == -* ]]; then
- COMPREPLY=( $(compgen -W '$(_parse_usage "$1") -6' -- "$cur") )
+ COMPREPLY=($(compgen -W '$(_parse_usage "$1") -6' -- "$cur"))
return
fi
- local i args=0
- for (( i=1; i < cword; i++ )); do
- [[ ${words[i]} != -* && ${words[i-1]} != @(-p|-h) ]] && (( args++ ))
+ local i args
+ args=0
+ for ((i = 1; i < cword; i++)); do
+ [[ ${words[i]} != -* && ${words[i - 1]} != @(-p|-h) ]] && ((args++))
done
case $args in
0)
- COMPREPLY=( $(compgen -W "$($1 help 2>/dev/null | \
+ COMPREPLY=($(compgen -W "$($1 help 2>/dev/null |
awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" \
- -- "$cur") )
+ -- "$cur"))
;;
1)
_chronyc_command_args "$1"
- if [[ ! $COMPREPLY && $prev == sources?(tats) ]]; then
+ if [[ ! ${COMPREPLY-} && $prev == sources?(tats) ]]; then
# [-v] not handled by _chronyc_command_args yet
- COMPREPLY=( $(compgen -W '-v' -- "$cur") )
+ COMPREPLY=($(compgen -W '-v' -- "$cur"))
fi
;;
2)
@@ -54,6 +56,6 @@ _chronyc()
;;
esac
} &&
-complete -F _chronyc chronyc
+ complete -F _chronyc chronyc
# ex: filetype=sh