[Bash-completion-commits] [SCM] bash-completion branch, master, updated. d13d73345ea6c23fba54c335e0f839d27fe7f8a5

Guillaume Rousse guillaume at oberkampf.msr-inria.inria.fr
Sun Sep 20 20:10:36 UTC 2009


The following commit has been merged in the master branch:
commit f5b6261826a1153248626f0cba533c4599136260
Author: Guillaume Rousse <guillaume at oberkampf.msr-inria.inria.fr>
Date:   Sun Sep 20 22:12:01 2009 +0200

    add rfkill completion

diff --git a/Makefile.am b/Makefile.am
index 744456c..54e4a90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -109,6 +109,7 @@ bashcomp_DATA = contrib/ant \
 		contrib/repomanage \
 		contrib/reportbug \
 		contrib/resolvconf \
+		contrib/rfkill \
 		contrib/ri \
 		contrib/rpcdebug \
 		contrib/rpm \
diff --git a/contrib/rfkill b/contrib/rfkill
new file mode 100644
index 0000000..d1ca395
--- /dev/null
+++ b/contrib/rfkill
@@ -0,0 +1,36 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for rfkill
+
+have rfkill &&
+_rfkill()
+{
+	local cur prev
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	
+	if [[ "$cur" == -* ]]; then
+		COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+	else
+		case $COMP_CWORD in
+			1)
+				COMPREPLY=( $( compgen -W "help event list \
+					block unblock" -- $cur ) )
+				;;
+			2)
+				prev=${COMP_WORDS[COMP_CWORD-1]}
+				if [ $prev == block -o $prev == unblock ]; then
+					COMPREPLY=( $( compgen -W \
+						"$(rfkill list | awk -F: \
+						'/^[0-9]/ {print $1}') \
+						all wifi bluetooth uwb wimax \
+						wwan gps" -- $cur ) )
+				fi
+				;;
+		esac
+	fi
+} &&
+complete -F _rfkill rfkill
+

-- 
bash-completion



More information about the Bash-completion-commits mailing list