[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-99-ge3ca91b
Ville Skyttä
ville.skytta at iki.fi
Wed Apr 20 20:14:27 UTC 2011
The following commit has been merged in the master branch:
commit 66dd0b35a20a75c6424b06751a2e9d24afc878a9
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed Apr 20 22:51:41 2011 +0300
Use _init_completion() in completions/n*.
diff --git a/completions/ncftp b/completions/ncftp
index 152d9c4..9492efc 100644
--- a/completions/ncftp
+++ b/completions/ncftp
@@ -4,12 +4,10 @@ have ncftp || return
_ncftp()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then
+ if [[ $cword -eq 1 && -f ~/.ncftp/bookmarks ]]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
~/.ncftp/bookmarks )' -- "$cur" ) )
fi
diff --git a/completions/net-tools b/completions/net-tools
index e7de2b0..9cdb465 100644
--- a/completions/net-tools
+++ b/completions/net-tools
@@ -3,11 +3,10 @@
have mii-tool &&
_mii_tool()
{
- 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
@@ -37,11 +36,10 @@ complete -F _mii_tool -o default mii-tool
have mii-diag &&
_mii_diag()
{
- 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
@@ -71,10 +69,8 @@ complete -F _mii_diag -o default mii-diag
[ $UNAME = Linux ] && have route &&
_route()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
if [ "$prev" = dev ]; then
_available_interfaces
@@ -86,8 +82,8 @@ _route()
for opt in add del -host -net netmask metric mss window irtt reject mod \
dyn reinstate dev default gw; do
found=false
- for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
- [ "${COMP_WORDS[i]}" = "$opt" ] && found=true && break
+ for (( i=1; i < ${#words[@]}-1; i++ )); do
+ [ "${words[i]}" = "$opt" ] && found=true && break
done
$found || COMPREPLY[${#COMPREPLY[@]}]="$opt"
done
@@ -99,9 +95,8 @@ complete -F _route route
have ether-wake &&
_ether_wake()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref -n : cur prev
+ local cur prev words cword
+ _init_completion -n : || return
case $prev in
-i)
diff --git a/completions/nmap b/completions/nmap
index f1ea1c4..2c28af1 100644
--- a/completions/nmap
+++ b/completions/nmap
@@ -4,11 +4,8 @@ have nmap || return
_nmap()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=`_get_pword`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-iL|-oN|-oX|-oS|-oG|---excludefile|--resume|--stylesheet)
diff --git a/completions/ntpdate b/completions/ntpdate
index 9cee6b6..594cddf 100644
--- a/completions/ntpdate
+++ b/completions/ntpdate
@@ -4,10 +4,8 @@ have ntpdate || return
_ntpdate()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-k)
--
bash-completion
More information about the Bash-completion-commits
mailing list