chronyc: New completion.
This commit is contained in:
parent
74a37e7507
commit
ff11fed5f8
@ -41,6 +41,7 @@ bashcomp_DATA = a2x \
|
|||||||
chkconfig \
|
chkconfig \
|
||||||
chown \
|
chown \
|
||||||
chpasswd \
|
chpasswd \
|
||||||
|
chronyc \
|
||||||
chrpath \
|
chrpath \
|
||||||
chsh \
|
chsh \
|
||||||
cksfv \
|
cksfv \
|
||||||
|
69
completions/chronyc
Normal file
69
completions/chronyc
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# chronyc(1) completion -*- shell-script -*-
|
||||||
|
|
||||||
|
_chronyc()
|
||||||
|
{
|
||||||
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
--help|-p)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-h)
|
||||||
|
_known_hosts_real "$cur"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local i 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 | \
|
||||||
|
awk 'NR > 1 { sub("\\|", " ", $1); print $1 }' )" -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
case $prev in
|
||||||
|
accheck|cmdaccheck|delete|maxdelay|maxdelayratio|\
|
||||||
|
maxdelaydevratio|maxpoll|minpoll|minstratum|polltarget)
|
||||||
|
_known_hosts_real "$cur"
|
||||||
|
;;
|
||||||
|
add)
|
||||||
|
COMPREPLY=( $( compgen -W 'peer server' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
allow|cmdallow|cmddeny|deny)
|
||||||
|
COMPREPLY=( $( compgen -W 'all' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
authhash)
|
||||||
|
COMPREPLY=( $( compgen -W 'MD5 SHA1' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
dns)
|
||||||
|
COMPREPLY=( $( compgen -W '-n +n -4 -6 -46' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
local)
|
||||||
|
COMPREPLY=( $( compgen -W 'off stratum' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
manual)
|
||||||
|
COMPREPLY=( $( compgen -W 'list on off reset' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
sources|sourcestats)
|
||||||
|
COMPREPLY=( $( compgen -W '-v' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
[[ $prev == @(peer|server) ]] && _known_hosts_real "$cur"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
} &&
|
||||||
|
complete -F _chronyc chronyc
|
||||||
|
|
||||||
|
# ex: ts=4 sw=4 et filetype=sh
|
1
test/completion/chronyc.exp
Normal file
1
test/completion/chronyc.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions chronyc
|
21
test/lib/completions/chronyc.exp
Normal file
21
test/lib/completions/chronyc.exp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "chronyc -"
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
assert_complete_any "chronyc "
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user