[Bash-completion-commits] [bash-completion] 01/01: synclient: New completion

Ville Skyttä scop-guest at moszumanska.debian.org
Fri Feb 6 18:39:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit 6a1bf8d11430fea80864bd0fef46210143d91407
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Feb 6 20:38:39 2015 +0200

    synclient: New completion
---
 completions/Makefile.am            |  1 +
 completions/synclient              | 24 ++++++++++++++++++++++++
 test/completion/synclient.exp      |  1 +
 test/lib/completions/synclient.exp | 18 ++++++++++++++++++
 4 files changed, 44 insertions(+)

diff --git a/completions/Makefile.am b/completions/Makefile.am
index 5c8f61c..d485143 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -348,6 +348,7 @@ bashcomp_DATA = 2to3 \
 		_svnadmin \
 		_svnlook \
 		sync_members \
+		synclient \
 		sysbench \
 		sysctl \
 		tar \
diff --git a/completions/synclient b/completions/synclient
new file mode 100644
index 0000000..55c8ba8
--- /dev/null
+++ b/completions/synclient
@@ -0,0 +1,24 @@
+# bash completion for synclient(1)                         -*- shell-script -*-
+
+_synclient()
+{
+    local cur prev words cword split
+    _init_completion -n = || return
+
+    case $prev in
+        -\?|-h|-V)
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+    elif [[ $cur != *=?* ]]; then
+        COMPREPLY=( $( compgen -S = -W '$( $1 -l 2>/dev/null | \
+            awk "/^[[:space:]]/ { print \$1 }" )' -- "$cur" ) )
+        compopt -o nospace
+    fi
+} &&
+complete -F _synclient synclient
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/synclient.exp b/test/completion/synclient.exp
new file mode 100644
index 0000000..9a27709
--- /dev/null
+++ b/test/completion/synclient.exp
@@ -0,0 +1 @@
+assert_source_completions synclient
diff --git a/test/lib/completions/synclient.exp b/test/lib/completions/synclient.exp
new file mode 100644
index 0000000..434e98f
--- /dev/null
+++ b/test/lib/completions/synclient.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "synclient "
+sync_after_int
+
+
+teardown

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list