about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorJun T <takimoto-j@kba.biglobe.ne.jp>2014-06-30 20:45:13 +0900
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-30 20:07:04 +0100
commitc8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c (patch)
tree230a9357f5e0a886b0ddb94443d272971aeff774 /Completion
parentfa4c71b29ef177077af778b45db1685563cb1ab4 (diff)
downloadzsh-c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c.tar.gz
zsh-c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c.tar.xz
zsh-c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c.zip
32823: complete file instead of Perl script after -
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_perl14
1 files changed, 13 insertions, 1 deletions
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 '-'