summaryrefslogtreecommitdiff
path: root/completions/chronyc
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2013-04-05 12:55:51 +0200
committerDavid Paleino <dapal@debian.org>2013-04-05 12:55:51 +0200
commit09dbe3eeb2e9695d171a63e14361c4099b5be978 (patch)
tree69f099aab27e28b832e627de51ed2b99e3d7445c /completions/chronyc
parent0d099a545fed933f329f434a43b58edcb52d366c (diff)
parent3085c7e12179817a02a611016606391295c69942 (diff)
downloadbash-completion-09dbe3eeb2e9695d171a63e14361c4099b5be978.tar.gz
Merge branch 'master' into 2.x2.x
Diffstat (limited to 'completions/chronyc')
-rw-r--r--completions/chronyc69
1 files changed, 69 insertions, 0 deletions
diff --git a/completions/chronyc b/completions/chronyc
new file mode 100644
index 00000000..3544c753
--- /dev/null
+++ b/completions/chronyc
@@ -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