From c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c Mon Sep 17 00:00:00 2001 From: Jun T Date: Mon, 30 Jun 2014 20:45:13 +0900 Subject: 32823: complete file instead of Perl script after - --- Completion/Unix/Command/_perl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Completion') 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 # # 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 '-' -- cgit 1.4.1