[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:30 UTC 2011
The following commit has been merged in the master branch:
commit aef53c1160980819961de8fa5c57fb366fed3146
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed Apr 20 22:56:30 2011 +0300
Use _init_completion() in completions/o*.
diff --git a/completions/open-iscsi b/completions/open-iscsi
index a697417..0d01ca1 100644
--- a/completions/open-iscsi
+++ b/completions/open-iscsi
@@ -4,11 +4,10 @@ have iscsiadm || return
_iscsiadm()
{
- local cur prev mode 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
@@ -34,10 +33,9 @@ _iscsiadm()
$split && return 0
local options
- if [[ $COMP_CWORD -gt 1 ]] ; then
- mode=${COMP_WORDS[2]}
+ if [[ $cword -gt 1 ]] ; then
- case $mode in
+ case ${words[2]} in
discovery)
options='--help --version --debug --print --interface --type \
--portal --login --op --name --value'
diff --git a/completions/openldap b/completions/openldap
index 2f976e1..77b7f24 100644
--- a/completions/openldap
+++ b/completions/openldap
@@ -14,10 +14,8 @@ _ldap_protocols()
_ldapsearch()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -61,10 +59,8 @@ complete -F _ldapsearch ldapsearch
_ldapaddmodify()
{
- local cur prev options
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -86,9 +82,10 @@ _ldapaddmodify()
esac
if [[ "$cur" == -* ]]; then
+ local options
options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
-Q -U -R -x -X -Y -Z -ZZ -f'
- if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
+ if [[ ${words[0]} == ldapmodify ]]; then
options+=" -a"
fi
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
@@ -98,10 +95,8 @@ complete -F _ldapaddmodify ldapadd ldapmodify
_ldapdelete()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -131,10 +126,8 @@ complete -F _ldapdelete ldapdelete
_ldapcompare()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -164,10 +157,8 @@ complete -F _ldapcompare ldapcompare
_ldapmodrdn()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -197,10 +188,8 @@ complete -F _ldapmodrdn ldapmodrdn
_ldapwhoami()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -230,10 +219,8 @@ complete -F _ldapwhoami ldapwhoami
_ldappasswd()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
diff --git a/completions/openssl b/completions/openssl
index b5d191e..fd76c05 100644
--- a/completions/openssl
+++ b/completions/openssl
@@ -7,9 +7,9 @@ _openssl_sections()
local config f
# check if a specific configuration file is used
- for (( i=2; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -config ]]; then
- config=${COMP_WORDS[i+1]}
+ for (( i=2; i < cword; i++ )); do
+ if [[ "${words[i]}" == -config ]]; then
+ config=${words[i+1]}
break
fi
done
@@ -30,10 +30,10 @@ _openssl_sections()
_openssl()
{
- local cur prev commands command options formats
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local commands command options formats
commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \
dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \
@@ -50,10 +50,10 @@ _openssl()
rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \
rc4-40'
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
- command=${COMP_WORDS[1]}
+ command=${words[1]}
case $prev in
-CA|-CAfile|-CAkey|-CAserial|-cert|-certfile|-config|-content| \
-dcert|-dkey|-dhparam|-extfile|-in|-inkey|-kfile|-key|-keyout| \
--
bash-completion
More information about the Bash-completion-commits
mailing list