summaryrefslogtreecommitdiff
path: root/completions/perl
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-01-24 19:24:09 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-01-24 19:24:09 -0300
commit019f3cc463db63abc6460f97deb488deec43840b (patch)
tree08cd5387d6c8af6f688d6468c7e2ae9f25c449be /completions/perl
parent5732da2af736c40cf693354485446ab4867ecb4d (diff)
downloadbash-completion-019f3cc463db63abc6460f97deb488deec43840b.tar.gz
New upstream version 2.10upstream/2.10
Diffstat (limited to 'completions/perl')
-rw-r--r--completions/perl91
1 files changed, 53 insertions, 38 deletions
diff --git a/completions/perl b/completions/perl
index 98ddb9eb..bf117970 100644
--- a/completions/perl
+++ b/completions/perl
@@ -27,48 +27,63 @@ _perl()
optPrefix=-P$prev
optSuffix=-S/
prefix=$prev
- fi
- case $prev in
- -*[DeEiFl])
- return
- ;;
- -*[Ix])
- local IFS=$'\n'
- compopt -o filenames
- COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") )
- return
- ;;
- -*[mM])
- temp="${cur#-}"
- prefix+="${cur%$temp}"
- cur="$temp"
- _perl_helper modules $1
- return
- ;;
- -*V)
- if [[ $cur == :* ]]; then
- temp="${cur##+(:)}"
- prefix+="${cur%$temp}"
+ case $prev in
+ -*[DeEiFl])
+ return
+ ;;
+ -*[Ix])
local IFS=$'\n'
- COMPREPLY=( $(compgen -P "$prefix" -W \
- '$($1 -MConfig -e "print join \"\\n\",
- keys %Config::Config" 2>/dev/null)' -- "$temp") )
- __ltrim_colon_completions "$prefix$temp"
- fi
- return
- ;;
- -*d|-*dt)
- if [[ $cur == :* ]]; then
- temp="${cur#:}"
- prefix="$prefix${cur%$temp}"
- cur="Devel::$temp"
+ compopt -o filenames
+ COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") )
+ return
+ ;;
+ -*[mM])
+ temp="${cur#-}"
+ prefix+="${cur%$temp}"
+ cur="$temp"
_perl_helper modules $1
- fi
- ;;
- esac
+ return
+ ;;
+ -*V)
+ if [[ $cur == :* ]]; then
+ temp="${cur##+(:)}"
+ prefix+="${cur%$temp}"
+ local IFS=$'\n'
+ COMPREPLY=( $(compgen -P "$prefix" -W \
+ '$($1 -MConfig -e "print join \"\\n\",
+ keys %Config::Config" 2>/dev/null)' -- "$temp") )
+ __ltrim_colon_completions "$prefix$temp"
+ fi
+ return
+ ;;
+ -*d|-*dt)
+ if [[ $cur == :* ]]; then
+ temp="${cur#:}"
+ prefix="$prefix${cur%$temp}"
+ cur="Devel::$temp"
+ _perl_helper modules $1
+ fi
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
+ # Unlike other perl options, having a space between the `-e' and
+ # `-E' options and their arguments, e.g. `perl -e "exit 2"', is
+ # valid syntax. However, the argument is neither a filename nor a
+ # directory, but one line of perl program, thus do not suggest
+ # _filedir completion.
+ elif [[ "$prev" == -e ]] || [[ "$prev" == -E ]]; then
+ return
+
+ # Likewise, `-I' also accepts a space between option and argument
+ # and it takes a directory as value.
+ elif [[ "$prev" == -I ]]; then
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") )
+ return
+
+ elif [[ "$cur" == -* ]]; then
COMPREPLY=( $(compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p
-n -a -F -l -0 -I -m -M -P -S -x -i -e' -- "$cur") )
else