[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-339-gf1d5758
Ville Skyttä
ville.skytta at iki.fi
Thu Jun 2 07:52:44 UTC 2011
The following commit has been merged in the master branch:
commit f1d5758c76dedf83b581887ca154e4b074555f30
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Thu Jun 2 10:52:36 2011 +0300
hddtemp: New completion.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index d7d512c..929dc12 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -55,6 +55,7 @@ bashcomp_DATA = abook \
gpg \
gpg2 \
gzip \
+ hddtemp \
heimdal \
hping2 \
htpasswd \
diff --git a/completions/hddtemp b/completions/hddtemp
new file mode 100644
index 0000000..3e9f825
--- /dev/null
+++ b/completions/hddtemp
@@ -0,0 +1,46 @@
+# hddtemp(8) completion
+
+have hddtemp || return
+
+_hddtemp()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -f|--file)
+ _filedir db
+ return
+ ;;
+ -l|--listen)
+ _ip_addresses
+ return
+ ;;
+ -u|--unit)
+ COMPREPLY=( $( compgen -W 'C F' -- "$cur" ) )
+ return
+ ;;
+ -p|--port|-s|--separator|-S|--syslog|-v|--version|-h|-\?|--help)
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) --help' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ else
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+} &&
+complete -F _hddtemp hddtemp
+
+# 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/hddtemp.exp b/test/completion/hddtemp.exp
new file mode 100644
index 0000000..f8c63d6
--- /dev/null
+++ b/test/completion/hddtemp.exp
@@ -0,0 +1 @@
+assert_source_completions hddtemp
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/hddtemp.exp
similarity index 78%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/hddtemp.exp
index 77cd07f..a6721db 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/hddtemp.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "a2ps "
+assert_complete_any "hddtemp -"
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list