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

Ville Skyttä ville.skytta at iki.fi
Fri Jun 12 17:27:03 UTC 2009


The following commit has been merged in the master branch:
commit eea696d9cce1af91d15289614f102c15a0b5cd78
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Jun 12 20:18:09 2009 +0300

    Use _split_longopt in bluez-utils.

diff --git a/CHANGES b/CHANGES
index 4a65cf4..a4ce893 100644
--- a/CHANGES
+++ b/CHANGES
@@ -63,10 +63,10 @@ bash-completion (1.x)
     input in external command arguments.
   * Add _split_longopt() helper for improved handling of long options that
     take arguments in both "--foo bar" and "--foo=bar" formats.
-  * Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
-    cpio, dpkg, iptables, make, mc, mii-diag, mii-tool, mkinitrd, pkg-config,
-    postgresql, quota, reportbug, samba, smartctl, yum, and generic long option
-    completion (Alioth: #311398).
+  * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp,
+    chown, chkconfig, cpio, dpkg, iptables, make, mc, mii-diag, mii-tool,
+    mkinitrd, pkg-config, postgresql, quota, reportbug, samba, smartctl, yum,
+    and generic long option completion (Alioth: #311398).
   * Add chown --from and --reference value completions.
   * Add chgrp --reference value completion.
   * Do not assume all --foo= options take filenames in generic long option
diff --git a/contrib/bluez-utils b/contrib/bluez-utils
index f222323..8300ef2 100644
--- a/contrib/bluez-utils
+++ b/contrib/bluez-utils
@@ -46,35 +46,30 @@ _get_command()
 
 _hcitool()
 {
-	local cur prev
+	local cur prev split=false
 
 	COMPREPLY=()
 	cur=`_get_cword`
 	prev=${COMP_WORDS[COMP_CWORD-1]}
 
+	_split_longopt && split=true
+
 	case $prev in
 		-i)
 			_bluetooth_devices
 			return 0;
 			;;
+		--role)
+			COMPREPLY=( $( compgen -W 'm s' -- $cur ) )
+			return 0;
+			;;
+		--pkt-type)
+			_bluetooth_packet_types
+			return 0;
+			;;
 	esac
 
-	# --name=value style option
-	if [[ "$cur" == *=* ]]; then
-		prev=${cur/=*/}
-		cur=${cur/*=/}
-		case $prev in
-			--role)
-				COMPREPLY=( $( compgen -W 'm s' -- $cur ) )
-				return 0;
-				;;
-			--pkt-type)
-				_bluetooth_packet_types
-				return 0;
-				;;
-		esac
-	fi
-
+	$split && return 0
 
 	_get_command
 	if [ -z $command ]; then
@@ -95,8 +90,8 @@ _hcitool()
 				;;
 			cc)
 				if [[ "$cur" == -* ]]; then
-					COMPREPLY=( $( compgen -W '--role= \
-						--pkt-type=' -- $cur ) )
+					COMPREPLY=( $( compgen -W '--role \
+						--pkt-type' -- $cur ) )
 				else
 					_count_args
 					if [ $args -eq 2 ]; then
@@ -137,12 +132,14 @@ complete -F _hcitool hcitool
 
 _sdptool()
 {
-	local cur prev
+	local cur prev split=false
 
 	COMPREPLY=()
 	cur=`_get_cword`
 	prev=${COMP_WORDS[COMP_CWORD-1]}
 
+	_split_longopt && split=true
+
 	case $prev in
 		--bdaddr)
 			_bluetooth_adresses
@@ -150,6 +147,8 @@ _sdptool()
 			;;
 	esac
 
+	$split && return 0
+
 	_get_command
 	if [ -z $command ]; then
 		if [[ "$cur" == -* ]]; then
@@ -178,8 +177,8 @@ _sdptool()
 				;;
 			add)
 				if [[ "$cur" == -* ]]; then
-					COMPREPLY=( $( compgen -W '--handle= \
-						--channel=' -- $cur ) )
+					COMPREPLY=( $( compgen -W '--handle \
+						--channel' -- $cur ) )
 				else
 					_bluetooth_services
 				fi

-- 
bash-completion



More information about the Bash-completion-commits mailing list