[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 9c402241c485ec6dea0915e071f70db2b2107246
Ville Skyttä
ville.skytta at iki.fi
Wed Dec 30 20:59:29 UTC 2009
The following commit has been merged in the master branch:
commit 9c402241c485ec6dea0915e071f70db2b2107246
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed Dec 30 22:59:17 2009 +0200
Add rtcwake completion.
diff --git a/CHANGES b/CHANGES
index c76677a..399f434 100644
--- a/CHANGES
+++ b/CHANGES
@@ -29,8 +29,8 @@ bash-completion (2.x)
mysqladmin, rsync, screen, service, scp, ssh, sshfs, update-alternatives,
vncviewer, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
- * Add cvsps, fusermount, jarsigner, k3b, lftpget, pm-utils, pack200 and
- unpack200 completions.
+ * Add cvsps, fusermount, jarsigner, k3b, lftpget, pm-utils, rtcwake, pack200
+ and unpack200 completions.
* Don't overwrite other host completions when completing from multiple
SSH known hosts files.
* Speed up installed rpm package completion on SUSE, based on work by
diff --git a/Makefile.am b/Makefile.am
index 06309d3..db0fbab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,6 +117,7 @@ bashcomp_DATA = contrib/abook \
contrib/rpmcheck \
contrib/rrdtool \
contrib/rsync \
+ contrib/rtcwake \
contrib/samba \
contrib/sbcl \
contrib/screen \
diff --git a/contrib/rtcwake b/contrib/rtcwake
new file mode 100644
index 0000000..42637e6
--- /dev/null
+++ b/contrib/rtcwake
@@ -0,0 +1,39 @@
+# bash completion for rtcwake
+
+have rtcwake &&
+_rtcwake()
+{
+ COMPREPLY=()
+ local cur=`_get_cword` prev=`_get_pword` split=false
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|-h|--version|-V|--seconds|-s|--time|-t)
+ return 0
+ ;;
+ --mode|-m)
+ COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) )
+ return 0
+ ;;
+ --device|-d)
+ COMPREPLY=( $( command ls -d /dev/rtc* 2>/dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ COMPREPLY=( $( compgen -W '--device --local --mode --seconds --time --utc \
+ --verbose --version --help' -- "$cur" ) )
+} &&
+complete -F _rtcwake rtcwake
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/rtcwake.exp b/test/completion/rtcwake.exp
new file mode 100644
index 0000000..3970a42
--- /dev/null
+++ b/test/completion/rtcwake.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type rtcwake]} {
+ source "lib/completions/rtcwake.exp"
+}; # if
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/rtcwake.exp
similarity index 82%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/rtcwake.exp
index 3f4e301..0b9a974 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/rtcwake.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "abook "
+assert_complete_any "rtcwake "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list