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