[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-80-gff11fed
Ville Skyttä
ville.skytta at iki.fi
Sat Dec 8 08:03:00 UTC 2012
The following commit has been merged in the master branch:
commit ff11fed5f8f1d73b02d515da3af335644807ab4d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sat Dec 8 10:02:52 2012 +0200
chronyc: New completion.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index a5f99d8..2efe322 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -41,6 +41,7 @@ bashcomp_DATA = a2x \
chkconfig \
chown \
chpasswd \
+ chronyc \
chrpath \
chsh \
cksfv \
diff --git a/completions/chronyc b/completions/chronyc
new file mode 100644
index 0000000..3544c75
--- /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
diff --git a/test/completion/chronyc.exp b/test/completion/chronyc.exp
new file mode 100644
index 0000000..9f7d821
--- /dev/null
+++ b/test/completion/chronyc.exp
@@ -0,0 +1 @@
+assert_source_completions chronyc
diff --git a/test/lib/completions/arping.exp b/test/lib/completions/chronyc.exp
similarity index 67%
copy from test/lib/completions/arping.exp
copy to test/lib/completions/chronyc.exp
index 531bb07..3345811 100644
--- a/test/lib/completions/arping.exp
+++ b/test/lib/completions/chronyc.exp
@@ -11,10 +11,10 @@ proc teardown {} {
setup
-assert_complete_any "arping "
+assert_complete_any "chronyc -"
sync_after_int
-assert_complete_any "arping -"
+assert_complete_any "chronyc "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list