Use _split_longopt in bluez-utils.

This commit is contained in:
Ville Skyttä 2009-06-12 20:18:09 +03:00
parent a8723b42ea
commit eea696d9cc
2 changed files with 25 additions and 26 deletions

View File

@ -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

View File

@ -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