[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-104-gaa411dd

Ville Skyttä ville.skytta at iki.fi
Thu Apr 21 09:41:57 UTC 2011


The following commit has been merged in the master branch:
commit 9f45e81e65411b584f7ad4d629907c4118566b62
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Apr 21 12:33:05 2011 +0300

    Drop no longer needed _compopt_o_filenames().
    
    Use compopt -o filenames directly instead.

diff --git a/bash_completion b/bash_completion
index fa408d0..cc3bf3d 100644
--- a/bash_completion
+++ b/bash_completion
@@ -597,19 +597,6 @@ _quote_readline_by_ref()
 } # _quote_readline_by_ref()
 
 
-# This function turns on "-o filenames" behavior dynamically. It is present
-# for bash < 4 reasons. See http://bugs.debian.org/272660#64 for info about
-# the bash < 4 compgen hack.
-_compopt_o_filenames()
-{
-    # We test for compopt availability first because directly invoking it on
-    # bash < 4 at this point may cause terminal echo to be turned off for some
-    # reason, see https://bugzilla.redhat.com/653669 for more info.
-    type compopt &>/dev/null && compopt -o filenames 2>/dev/null || \
-        compgen -f /non-existing-dir/ >/dev/null
-}
-
-
 # This function performs file and directory completion. It's better than
 # simply using 'compgen -f', because it honours spaces in filenames.
 # @param $1  If `-d', complete only on directories.  Otherwise filter/pick only
@@ -649,7 +636,7 @@ _filedir()
     [[ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
         toks+=( $( compgen -f -- $quoted ) )
 
-    [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
+    [ ${#toks[@]} -ne 0 ] && compopt -o filenames 2>/dev/null
 
     COMPREPLY+=( "${toks[@]}" )
 } # _filedir()
@@ -859,7 +846,7 @@ _tilde() {
     local result=0
     # Does $1 start with tilde (~) and doesn't contain slash (/)?
     if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
-        _compopt_o_filenames
+        compopt -o filenames 2>/dev/null
         # Try generate username completions
         COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
         result=${#COMPREPLY[@]}
@@ -1447,7 +1434,7 @@ _cd()
         return 0
     fi
 
-    _compopt_o_filenames
+    compopt -o filenames
 
     # Use standard dir completion if no CDPATH or parameter starts with /,
     # ./ or ../
@@ -1544,7 +1531,7 @@ _command_offset()
     _get_comp_words_by_ref cur
 
     if [[ $COMP_CWORD -eq 0 ]]; then
-        _compopt_o_filenames
+        compopt -o filenames
         COMPREPLY=( $( compgen -c -- "$cur" ) )
     else
         cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}
@@ -1577,7 +1564,7 @@ _command_offset()
                     if [[ "$cspec" != @(dir|file)names ]]; then
                         COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
                     else
-                        _compopt_o_filenames
+                        compopt -o filenames
                     fi
                 fi
             else
@@ -1693,7 +1680,7 @@ _filedir_xspec()
         }
         ))
 
-    [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
+    [ ${#toks[@]} -ne 0 ] && compopt -o filenames
     COMPREPLY=( "${toks[@]}" )
 }
 list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
diff --git a/completions/bzip2 b/completions/bzip2
index 588400c..f8f970a 100644
--- a/completions/bzip2
+++ b/completions/bzip2
@@ -34,7 +34,7 @@ _bzip2()
 
     _expand || return 0
 
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
         $( compgen -d -- "$cur" ) )
 } &&
diff --git a/completions/cpio b/completions/cpio
index 995ca86..71743b0 100644
--- a/completions/cpio
+++ b/completions/cpio
@@ -30,7 +30,7 @@ _cpio()
             return 0
             ;;
         --rsh-command)
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY=( $( compgen -c -- "$cur" ) )
             return 0
             ;;
diff --git a/completions/gdb b/completions/gdb
index f59f2b1..6bd32ad 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -9,7 +9,7 @@ _gdb()
 
     if [ $cword -eq 1 ]; then
         local IFS
-        _compopt_o_filenames
+        compopt -o filenames
         if [[ "$cur" == */* ]]; then
             # compgen -c works as expected if $cur contains any slashes.
             IFS=$'\n'
diff --git a/completions/gzip b/completions/gzip
index 5699701..e2e482e 100644
--- a/completions/gzip
+++ b/completions/gzip
@@ -34,7 +34,7 @@ _gzip()
 
     _expand || return 0
 
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
         $( compgen -d -- "$cur" ) )
 } &&
diff --git a/completions/kldload b/completions/kldload
index 1fb0443..1637316 100644
--- a/completions/kldload
+++ b/completions/kldload
@@ -10,7 +10,7 @@ _kldload()
     local moddir=/modules/
     [ -d $moddir ] || moddir=/boot/kernel/
 
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f "$moddir$cur" ) )
     COMPREPLY=( ${COMPREPLY[@]#$moddir} )
     COMPREPLY=( ${COMPREPLY[@]%.ko} )
diff --git a/completions/lrzip b/completions/lrzip
index 0e24f0d..ffd95a7 100644
--- a/completions/lrzip
+++ b/completions/lrzip
@@ -49,7 +49,7 @@ _lrzip()
     _expand || return 0
 
     local IFS=$'\n'
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
         $( compgen -d -- "$cur" ) )
 } &&
diff --git a/completions/lzma b/completions/lzma
index 7a74368..cb5b2ce 100644
--- a/completions/lzma
+++ b/completions/lzma
@@ -29,7 +29,7 @@ _lzma()
 
     _expand || return 0
 
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
         $( compgen -d -- "$cur" ) )
 } &&
diff --git a/completions/lzop b/completions/lzop
index b2f2a94..a88ec46 100644
--- a/completions/lzop
+++ b/completions/lzop
@@ -53,7 +53,7 @@ _lzop()
     _expand || return 0
 
     local IFS=$'\n'
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
             $( compgen -d -- "$cur" ) )
 } &&
diff --git a/completions/monodevelop b/completions/monodevelop
index b53f3ca..0da791f 100644
--- a/completions/monodevelop
+++ b/completions/monodevelop
@@ -49,7 +49,7 @@ _mdtool()
                 return 0
                 ;;
             "generate-makefiles")
-                _compopt_o_filenames
+                compopt -o filenames
                 COMPREPLY=( $( compgen -o filenames -G"*.mds" -- "$cur" ) )
                 if [[ "$prev" == *mds ]]; then
                     COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
diff --git a/completions/mutt b/completions/mutt
index 8925d5a..8c40b94 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -123,7 +123,7 @@ _muttfiledir()
 
         # Match any file in $folder beginning with $cur
         # (minus the leading '=' sign).
-        _compopt_o_filenames
+        compopt -o filenames
         COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
         COMPREPLY=( ${COMPREPLY[@]#$folder/} )
         return 0
diff --git a/completions/perl b/completions/perl
index dcf5d5b..b8a87f0 100644
--- a/completions/perl
+++ b/completions/perl
@@ -40,7 +40,7 @@ _perl()
             ;;
         -I|-x)
             local IFS=$'\n'
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
             return 0
             ;;
diff --git a/completions/postfix b/completions/postfix
index c52f9e1..553659a 100644
--- a/completions/postfix
+++ b/completions/postfix
@@ -54,7 +54,7 @@ _postmap()
     fi
 
     if [[ "$cur" == *:* ]]; then
-        _compopt_o_filenames
+        compopt -o filenames
         COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
     else
         local len=${#cur} idx=0 pval
@@ -65,7 +65,7 @@ _postmap()
             fi
         done
         if [[ $idx -eq 0 ]]; then
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY=( $( compgen -f -- "$cur" ) )
         fi
     fi
diff --git a/completions/rpm b/completions/rpm
index 005cfbd..354e3e8 100644
--- a/completions/rpm
+++ b/completions/rpm
@@ -71,7 +71,7 @@ _rpm()
             return 0
             ;;
         --pipe)
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY=( $( compgen -c -- "$cur" ) )
             return 0
             ;;
diff --git a/completions/ssh b/completions/ssh
index 5237dda..775b5f5 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -181,7 +181,7 @@ _ssh()
         done
         _known_hosts_real -a -F "$configfile" "$cur"
         if [ $cword -ne 1 ]; then
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY+=( $( compgen -c -- "$cur" ) )
         fi
     fi
diff --git a/completions/tar b/completions/tar
index 9d87578..b802133 100644
--- a/completions/tar
+++ b/completions/tar
@@ -92,7 +92,7 @@ _tar()
             ;;
         -F|--info-script|--new-volume-script|--rmt-command|--rsh-command|\
         -I|--use-compress-program)
-            _compopt_o_filenames
+            compopt -o filenames
             COMPREPLY=( $( compgen -c -- "$cur" ) )
             return 0
             ;;
diff --git a/completions/xz b/completions/xz
index 8a4fc5e..96e1a0a 100644
--- a/completions/xz
+++ b/completions/xz
@@ -52,7 +52,7 @@ _xz()
     _expand || return 0
 
     local IFS=$'\n'
-    _compopt_o_filenames
+    compopt -o filenames
     COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
         $( compgen -d -- "$cur" ) )
 } &&
diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 24f2863..d7ddb8e 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -60,11 +60,11 @@ key combinations.
 As a rule of thumb, do not use "complete -o filenames". Doing it makes
 it take effect for all completions from the affected function, which
 may break things if some completions from the function must not be
-escaped as filenames. Instead, use the _compopt_o_filenames function
-to turn on "-o filenames" behavior dynamically when returning
-completions that need that kind of processing (e.g. file and command
-names). The _filedir and _filedir_xspec helpers do this automatically
-whenever they return some completions.
+escaped as filenames. Instead, use "compopt -o filenames" to turn on
+"-o filenames" behavior dynamically when returning completions that
+need that kind of processing (e.g. file and command names). The
+_filedir and _filedir_xspec helpers do this automatically whenever
+they return some completions.
 
 /////////////////////////////////////////
 case/esac vs if

-- 
bash-completion



More information about the Bash-completion-commits mailing list