[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 76cf12bc190035740387d4b45e64f53aef5bb4e7

Ville Skyttä ville.skytta at iki.fi
Fri Nov 19 20:14:14 UTC 2010


The following commit has been merged in the master branch:
commit e9bf8773ecffbd28301e72a0fea4a05d96b29a00
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Nov 19 22:04:43 2010 +0200

    Add perl -V completion.

diff --git a/completions/perl b/completions/perl
index 655ff65..4b506fc 100644
--- a/completions/perl
+++ b/completions/perl
@@ -49,6 +49,18 @@ _perl()
             _perlmodules $1
             return 0
             ;;
+        -V)
+            if [[ $cur == :* ]]; then
+                temp="${cur##+(:)}"
+                prefix="$prefix${cur%$temp}"
+                local IFS=$'\n'
+                COMPREPLY=( $( compgen -P "$prefix" -W \
+                    '$( $1 -MConfig -e "print join \"\\n\",
+                        keys %Config::Config" 2>/dev/null )' -- "$temp" ) )
+                __ltrim_colon_completions "$prefix$temp"
+            fi
+            return 0
+            ;;
     esac
 
     if [[ "$cur" == -* ]]; then
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
index 092aab3..8cd6f95 100644
--- a/test/lib/completions/perl.exp
+++ b/test/lib/completions/perl.exp
@@ -94,6 +94,12 @@ sync_after_int
 assert_no_complete "perl -e "
 sync_after_int
 
+assert_complete_any "perl -V:install"
+sync_after_int
+
+assert_complete_any "perl -V::install"
+sync_after_int
+
 # Assuming that File::Spec and friends are always installed...
 
 assert_complete_any "perl -MFile"

-- 
bash-completion



More information about the Bash-completion-commits mailing list