diff options
Diffstat (limited to 'completions/perl')
-rw-r--r-- | completions/perl | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/completions/perl b/completions/perl index bf117970..9823d730 100644 --- a/completions/perl +++ b/completions/perl @@ -2,9 +2,9 @@ _perl_helper() { - COMPREPLY=( $(compgen -P "$prefix" -W \ + COMPREPLY=($(compgen -P "$prefix" -W \ "$(${2:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl $1 $cur)" \ - -- "$cur") ) + -- "$cur")) [[ $1 == functions ]] || __ltrim_colon_completions "$prefix$cur" } @@ -16,7 +16,7 @@ _perl() local prefix="" temp optPrefix optSuffix # If option not followed by whitespace, reassign prev and cur - if [[ "$cur" == -?* ]]; then + if [[ $cur == -?* ]]; then temp=$cur prev=${temp:0:2} cur=${temp:2} @@ -35,7 +35,7 @@ _perl() -*[Ix]) local IFS=$'\n' compopt -o filenames - COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") ) + COMPREPLY=($(compgen -d $optPrefix $optSuffix -- "$cur")) return ;; -*[mM]) @@ -50,14 +50,14 @@ _perl() temp="${cur##+(:)}" prefix+="${cur%$temp}" local IFS=$'\n' - COMPREPLY=( $(compgen -P "$prefix" -W \ + COMPREPLY=($(compgen -P "$prefix" -W \ '$($1 -MConfig -e "print join \"\\n\", - keys %Config::Config" 2>/dev/null)' -- "$temp") ) + keys %Config::Config" 2>/dev/null)' -- "$temp")) __ltrim_colon_completions "$prefix$temp" fi return ;; - -*d|-*dt) + -*d | -*dt) if [[ $cur == :* ]]; then temp="${cur#:}" prefix="$prefix${cur%$temp}" @@ -72,25 +72,25 @@ _perl() # 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 + 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 + elif [[ $prev == -I ]]; then local IFS=$'\n' compopt -o filenames - COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") ) + 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") ) + 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 _filedir fi } && -complete -F _perl perl + complete -F _perl perl _perldoc() { @@ -100,7 +100,7 @@ _perldoc() local prefix="" temp # completing an option (may or may not be separated by a space) - if [[ "$cur" == -?* ]]; then + if [[ $cur == -?* ]]; then temp=$cur prev=${temp:0:2} cur=${temp:2} @@ -108,7 +108,7 @@ _perldoc() fi local perl="${1%doc}" - [[ $perl == $1 ]] || ! type $perl &>/dev/null && perl= + [[ $perl == "$1" ]] || ! type $perl &>/dev/null && perl= case $prev in -*[hVnoMwL]) @@ -124,23 +124,23 @@ _perldoc() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else # return available modules (unless it is clearly a file) - if [[ "$cur" != @(*/|[.~])* ]]; then + if [[ $cur != @(*/|[.~])* ]]; then _perl_helper perldocs $perl if [[ $cur == p* ]]; then - COMPREPLY+=( $(compgen -W \ + COMPREPLY+=($(compgen -W \ '$(PERLDOC_PAGER=cat "$1" -u perl | \ command sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }")' \ - -- "$cur") ) + -- "$cur")) fi fi _filedir 'p@([lm]|od)' fi } && -complete -F _perldoc -o bashdefault perldoc + complete -F _perldoc -o bashdefault perldoc # ex: filetype=sh |