[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-249-g4632248

David Paleino dapal at debian.org
Mon May 2 17:05:43 UTC 2011


The following commit has been merged in the master branch:
commit 4632248cbbc63f140a9e137e889e0185de8d7b54
Author: David Paleino <dapal at debian.org>
Date:   Mon May 2 19:01:33 2011 +0200

    Get rid of $BASH_COMPLETION as well

diff --git a/Makefile.am b/Makefile.am
index 2954675..14241e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = completions test
+SUBDIRS = completions helpers test
 
 pkgdata_DATA = bash_completion
 
diff --git a/README b/README
index 4931712..b95e2f2 100644
--- a/README
+++ b/README
@@ -38,11 +38,6 @@ if [ -f /sw/etc/bash_completion ]; then
    . /sw/etc/bash_completion
 fi
 
-If you are putting the bash completion source file somewhere other
-than /etc/bash_completion, you should ensure that $BASH_COMPLETION is
-set to point to it before you source it. Your ~/.bashrc file is a good
-place to do this.
-
 
 TROUBLESHOOTING
 ---------------
@@ -125,7 +120,7 @@ Q. I author/maintain package X and would like to maintain my own
    completion code for this package. Where should I put it to be sure
    that interactive bash shells will find it and source it?
 
-   Put it in the directory pointed to by $BASH_COMPLETION_DIR, which
+   Put it in the directory pointed to by $BASH_COMPLETION_COMPAT_DIR, which
    is defined at the beginning of the main completion script. Any
    scripts placed in this directory will be sourced by interactive
    bash shells. Usually, this is /etc/bash_completion.d.
diff --git a/bash_completion b/bash_completion
index 1459d2c..253d1fb 100644
--- a/bash_completion
+++ b/bash_completion
@@ -39,9 +39,8 @@ fi
 
 # Alter the following to reflect the location of this file.
 #
-[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/usr/share/bash-completion/bash_completion
 [ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
-readonly BASH_COMPLETION BASH_COMPLETION_COMPAT_DIR
+readonly BASH_COMPLETION_COMPAT_DIR
 
 # Set a couple of useful vars
 #
@@ -1752,7 +1751,7 @@ _filedir_xspec()
     local IFS=$'\n' xspec
     # get first exclusion compspec that matches this command
     xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
-        "$BASH_COMPLETION" )
+        "${BASH_SOURCE[0]}" )
     # prune to leave nothing but the -X spec
     xspec=${xspec#*-X }
     xspec=${xspec%% *}
@@ -1790,7 +1789,7 @@ _filedir_xspec()
     [ ${#toks[@]} -ne 0 ] && compopt -o filenames
     COMPREPLY=( "${toks[@]}" )
 }
-list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
+list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "${BASH_SOURCE[0]}" | \
     # read exclusion compspecs
     (
     while read line
@@ -1822,11 +1821,11 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
             && -f $i && -r $i ]] && . "$i"
     done
 fi
-if [[ "${BASH_COMPLETION%/*}/completions" != $BASH_COMPLETION_COMPAT_DIR && \
-    -d "${BASH_COMPLETION%/*}/completions" && -r "${BASH_COMPLETION%/*}/completions" && \
-    -x "${BASH_COMPLETION%/*}/completions" ]]; then
-    for i in $(LC_ALL=C command ls "${BASH_COMPLETION%/*}/completions"); do
-        i="${BASH_COMPLETION%/*}/completions/$i"
+if [[ "${BASH_SOURCE[0]%/*}/completions" != $BASH_COMPLETION_COMPAT_DIR && \
+    -d "${BASH_SOURCE[0]%/*}/completions" && -r "${BASH_SOURCE[0]%/*}/completions" && \
+    -x "${BASH_SOURCE[0]%/*}/completions" ]]; then
+    for i in $(LC_ALL=C command ls "${BASH_SOURCE[0]%/*}/completions"); do
+        i="${BASH_SOURCE[0]%/*}/completions/$i"
         [[ ${i##*/} != @($_backup_glob|Makefile*) \
             && -f $i && -r $i ]] && . "$i"
     done
@@ -1834,7 +1833,7 @@ fi
 unset i
 
 # source user completion file
-[[ $BASH_COMPLETION != ~/.bash_completion && -r ~/.bash_completion ]] \
+[[ ${BASH_SOURCE[0]} != ~/.bash_completion && -r ~/.bash_completion ]] \
     && . ~/.bash_completion
 unset -f have
 unset UNAME USERLAND have
diff --git a/bash_completion.sh.in b/bash_completion.sh.in
index a0ad487..a24f850 100644
--- a/bash_completion.sh.in
+++ b/bash_completion.sh.in
@@ -1,5 +1,5 @@
 # Check for interactive bash and that we haven't already been sourced.
-[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
+[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return
 
 # Check for recent enough version of bash.
 bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 936627f..a034b48 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1,4 +1,3 @@
-SUBDIRS = helpers
 bashcomp_DATA = abook \
 		ant \
 		apache2ctl \
diff --git a/completions/perl b/completions/perl
index e8334e3..f9cdbc4 100644
--- a/completions/perl
+++ b/completions/perl
@@ -5,7 +5,7 @@ have perl || return
 _perlmodules()
 {
     COMPREPLY=( $( compgen -P "$prefix" -W \
-        "$( ${1:-perl} ${BASH_COMPLETION%/*}/helpers/perl modules $cur )" \
+        "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl modules $cur )" \
         -- "$cur" ) )
     __ltrim_colon_completions "$prefix$cur"
 }
@@ -13,7 +13,7 @@ _perlmodules()
 _perlfunctions()
 {
     COMPREPLY=( $( compgen -P "$prefix" -W \
-        "$( ${1:-perl} ${BASH_COMPLETION%/*}/helpers/perl functions $cur )" \
+        "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl functions $cur )" \
         -- "$cur" ) )
 }
 
diff --git a/completions/helpers/Makefile.am b/helpers/Makefile.am
similarity index 100%
rename from completions/helpers/Makefile.am
rename to helpers/Makefile.am
diff --git a/completions/helpers/perl b/helpers/perl
similarity index 100%
rename from completions/helpers/perl
rename to helpers/perl

-- 
bash-completion



More information about the Bash-completion-commits mailing list