[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-6-g83c1f1a

Ville Skyttä ville.skytta at iki.fi
Thu Feb 10 20:28:39 UTC 2011


The following commit has been merged in the master branch:
commit 5792ac8760da2506af120f0afec5f71d818cba51
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Feb 10 21:57:38 2011 +0200

    Try harder to find the correct perl executable to run the perl helper with.
    
    It is now run explicitly with *some* perl executable.

diff --git a/CHANGES b/CHANGES
index 860f639..03f165f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ bash-completion (2.x)
 
   [ Ville Skyttä ]
   * Improve gendiff completion.
+  * Try harder to find the correct perl executable to run the perl helper with.
 
  -- David Paleino <d.paleino at gmail.com>  Sun, 06 Feb 2011 21:46:37 +0100
 
diff --git a/completions/perl b/completions/perl
index 843e249..7ddfffe 100644
--- a/completions/perl
+++ b/completions/perl
@@ -4,13 +4,17 @@ have perl &&
 {
 _perlmodules()
 {
-    COMPREPLY=( $( compgen -P "$prefix" -W "$( $1 ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" -- "$cur" ) )
+    COMPREPLY=( $( compgen -P "$prefix" -W \
+        "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" \
+        -- "$cur" ) )
     __ltrim_colon_completions "$prefix$cur"
 }
 
 _perlfunctions()
 {
-    COMPREPLY=( $( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" -- "$cur" ) )
+    COMPREPLY=( $( compgen -P "$prefix" -W \
+        "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" \
+        -- "$cur" ) )
 }
 
 _perl()
@@ -97,10 +101,13 @@ _perldoc()
         prefix=$prev
     fi
 
+    local perl="${1%doc}"
+    [[ $perl == $1 ]] || ! type $perl &>/dev/null && perl=
+
     # complete builtin perl functions
     case $prev in
         -f)
-            _perlfunctions "$cur"
+            _perlfunctions $perl
              return 0
             ;;
     esac
@@ -110,7 +117,7 @@ _perldoc()
     else
         # return available modules (unless it is clearly a file)
         if [[ "$cur" != */* ]]; then
-            _perlmodules
+            _perlmodules $perl
             COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
                 '$( PAGER=/bin/cat man perl |  \
                 sed -ne "/perl.*Perl overview/,/perlwin32/p" | \

-- 
bash-completion



More information about the Bash-completion-commits mailing list