summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_perl14
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ad7641759..9f4e0bfbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-30  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Jun T: 32823: Completion/Unix/Command/_perl: complete file
+	instead of script after -e.
+
 2014-06-26  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* Jun T: 32812: Doc/zsh.yo, Doc/ztexi.yo: put table of contents
diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl
index b00baa6ed..19212126e 100644
--- a/Completion/Unix/Command/_perl
+++ b/Completion/Unix/Command/_perl
@@ -4,6 +4,7 @@
 # Adam Spiers <adam@spiers.net>
 #
 # Completions currently based on Perl 5.14.1.
+typeset -A opt_args
 
 _perl () {
   _arguments -s \
@@ -40,10 +41,21 @@ _perl () {
     "(-w    -X)-W[enable all warnings (ignores 'no warnings')]" \
     "(-w -W   )-X[disable all warnings (ignores 'use warnings')]" \
     '-x-[strip off text before #!perl line and perhaps cd to directory]:directory to cd to:_files -/' \
-    '1:Perl script:_files -/ -g "*.(p[ml]|PL|t)(-.)"' \
+    '1:script or arg:_script_or_arg' \
     '*::args: _normal'
 }
 
+_script_or_arg () {
+  local expl
+  if [[ -n "$opt_args[(I)-(e|E)]" ]]; then
+    _description arg expl 'file'
+    _files "$expl[@]"
+  else
+    _description script expl 'Perl script'
+    _files "$expl[@]" -/ -g "*.(p[ml]|PL|t)(-.)"
+  fi
+}
+
 _perl_m_opt () {
   compset -P '-'