[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-84-g4c97896
Ville Skyttä
ville.skytta at iki.fi
Wed Apr 20 11:42:50 UTC 2011
The following commit has been merged in the master branch:
commit 5e343c89fbb59da914abcbf9d296dce9c43038fe
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed Apr 20 14:22:23 2011 +0300
Use _init_completion() in completions/b*.
diff --git a/completions/bash-builtins b/completions/bash-builtins
index 22229c3..3df3ddb 100644
--- a/completions/bash-builtins
+++ b/completions/bash-builtins
@@ -2,12 +2,10 @@
#
_alias()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- case $COMP_LINE in
+ case ${words[@]} in
*[^=])
COMPREPLY=( $( compgen -A alias -- "$cur" ) )
;;
@@ -23,12 +21,10 @@ complete -F _alias -o nospace alias
#
_export()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
- case $COMP_LINE in
+ case ${words[@]} in
*=\$*)
COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
;;
@@ -49,10 +45,8 @@ complete -F _export -o default -o nospace export
#
_function()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
if [[ $1 == @(declare|typeset) ]]; then
if [ "$prev" = -f ]; then
@@ -60,10 +54,10 @@ _function()
elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
fi
- elif [ $COMP_CWORD -eq 1 ]; then
+ elif [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -A function -- "$cur" ) )
else
- COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
+ COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" )
fi
} &&
complete -F _function function declare typeset
@@ -72,10 +66,8 @@ complete -F _function function declare typeset
#
_complete()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o)
diff --git a/completions/bind-utils b/completions/bind-utils
index aef40d9..79c02c7 100644
--- a/completions/bind-utils
+++ b/completions/bind-utils
@@ -4,10 +4,8 @@ have nslookup || return
_nslookup()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \
defname search port= querytype= type= recurse retry root timeout vc \
diff --git a/completions/bitkeeper b/completions/bitkeeper
index 8d70cf1..8f1d949 100644
--- a/completions/bitkeeper
+++ b/completions/bitkeeper
@@ -4,12 +4,10 @@ have bk || return
_bk()
{
- local BKCMDS
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
+ local BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
xargs printf '%s ' )"
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
diff --git a/completions/bittorrent b/completions/bittorrent
index de303c2..ba94075 100644
--- a/completions/bittorrent
+++ b/completions/bittorrent
@@ -5,10 +5,8 @@ have btdownloadheadless.py || have btdownloadcurses.py || \
_btdownload()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--responsefile|--saveas)
diff --git a/completions/bluez b/completions/bluez
index 3a3a5ec..82f66df 100644
--- a/completions/bluez
+++ b/completions/bluez
@@ -31,11 +31,10 @@ _bluetooth_packet_types()
_hcitool()
{
- local cur prev split=false arg
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+ local split=false
_split_longopt && split=true
case $prev in
@@ -114,11 +113,10 @@ complete -F _hcitool hcitool
_sdptool()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+ local split=false
_split_longopt && split=true
case $prev in
@@ -176,10 +174,8 @@ complete -F _sdptool sdptool
_l2ping()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-i)
@@ -198,10 +194,8 @@ complete -F _l2ping l2ping
_rfcomm()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f|--config)
@@ -244,10 +238,8 @@ complete -F _rfcomm rfcomm
_ciptool()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-i)
@@ -281,10 +273,8 @@ complete -F _ciptool ciptool
_dfutool()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-d|--device)
@@ -313,10 +303,8 @@ complete -F _dfutool dfutool
_hciconfig()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
local arg
_get_first_arg
@@ -360,10 +348,8 @@ complete -F _hciconfig hciconfig
_hciattach()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
@@ -398,10 +384,8 @@ complete -F _hciattach hciattach
_hid2hci()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \
@@ -412,10 +396,8 @@ complete -F _hid2hci hid2hci
_avctrl()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) )
diff --git a/completions/brctl b/completions/brctl
index 6b08757..8ae7dab 100644
--- a/completions/brctl
+++ b/completions/brctl
@@ -4,13 +4,12 @@ have brctl || return
_brctl()
{
- local cur command
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
- command=${COMP_WORDS[1]}
+ local command=${words[1]}
- case $COMP_CWORD in
+ case $cword in
1)
COMPREPLY=( $( compgen -W "addbr delbr addif delif \
setageing setbridgeprio setfd sethello \
diff --git a/completions/bzip2 b/completions/bzip2
index f19ea7d..588400c 100644
--- a/completions/bzip2
+++ b/completions/bzip2
@@ -4,10 +4,8 @@ have bzip2 || have pbzip2 || return
_bzip2()
{
- local cur prev xspec
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-b|-h|--help|-p)
@@ -16,15 +14,14 @@ _bzip2()
esac
if [[ "$cur" == -* ]]; then
- local helpopts=`_parse_help ${COMP_WORDS[0]}`
+ local helpopts=`_parse_help ${words[0]}`
COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \
-- "$cur" ) )
return 0
fi
- local IFS=$'\n'
+ local IFS=$'\n' xspec="*.bz2"
- xspec="*.bz2"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
--
bash-completion
More information about the Bash-completion-commits
mailing list