Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Pkg-zsh-devel] Bug#679824: zsh: Buggy perl completion with -e [origin: vincent@xxxxxxxxxx]
Sorry, I fotgot about the array $opt_args, which can be used to
detect the -e '...' on the command line.
But modifying the line '*::args: _normal' would be also OK.
diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl
index b00baa6..1921212 100644
--- a/Completion/Unix/Command/_perl
+++ b/Completion/Unix/Command/_perl
@@ -4,6 +4,7 @@
# Adam Spiers <adam@xxxxxxxxxx>
#
# 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 '-'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author