1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-08 12:01:21 +02:00

32823: complete file instead of Perl script after -

This commit is contained in:
Jun T 2014-06-30 20:45:13 +09:00 committed by Peter Stephenson
parent fa4c71b29e
commit c8e5be9d0f
2 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -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 '-'