mirror of
https://github.com/zsh-users/zsh
synced 2024-10-07 16:39:09 +00:00
minor completion fixes (11541)
This commit is contained in:
parent
63b7b10355
commit
b9195aa57d
|
@ -1,14 +1,18 @@
|
|||
#compdef chown chgrp
|
||||
|
||||
local suf
|
||||
|
||||
if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
|
||||
if [[ ${words[1]:t} = chgrp ]] || compset -P '*[:.]'; then
|
||||
_groups
|
||||
else
|
||||
if [[ $OSTYPE = (solaris*|hpux*) ]]; then
|
||||
_users -S ':' -q
|
||||
suf=':'
|
||||
else
|
||||
_users -S '.' -q
|
||||
suf='.'
|
||||
fi
|
||||
compset -S '.*' && unset suf
|
||||
_users -S "$suf" -q
|
||||
fi
|
||||
else
|
||||
_files
|
||||
|
|
|
@ -11,20 +11,22 @@
|
|||
if [[ ${+_perl_basepods} -eq 0 ]]; then
|
||||
typeset -agU _perl_basepods
|
||||
|
||||
if which basdepods >/dev/null; then
|
||||
if (( ${+commands[basepods]} )); then
|
||||
_perl_basepods=( ${$(basepods):t:r} )
|
||||
else
|
||||
local podpath
|
||||
|
||||
podpath=$(perl -MConfig -e 'print "$Config{installprivlib}/pod"')
|
||||
|
||||
if [[ ! -e $podpath/perl.pod ]]; then
|
||||
echo "Couldn't find perl.pod from Config.pm; giving up."
|
||||
return 1
|
||||
else
|
||||
cd $podpath
|
||||
_perl_basepods=( *.pod(:r:t) )
|
||||
cd $OLDPWD
|
||||
_perl_basepods=( ${podpath}/*.pod(:r:t) )
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
compadd - $_perl_basepods
|
||||
local expl
|
||||
|
||||
_wanted pods expl 'Perl base pods' compadd - $_perl_basepods
|
||||
|
|
|
@ -22,11 +22,11 @@ zparseopts -D -a opts S: q
|
|||
|
||||
if [[ ${+_perl_modules} -eq 0 ]]; then
|
||||
if zstyle -t ":completion:${curcontext}:modules" try-to-use-pminst \
|
||||
&& which pminst >/dev/null; then
|
||||
&& (( ${+commands[pminst]} )); then
|
||||
_perl_modules=( $(pminst) )
|
||||
else
|
||||
local inc libdir new_pms
|
||||
if which perl >/dev/null; then
|
||||
if (( ${+commands[perl]} )); then
|
||||
inc=( $( perl -e 'print "@INC"' ) )
|
||||
else
|
||||
# If perl isn't there, one wonders why the user's trying to
|
||||
|
|
|
@ -1,15 +1,31 @@
|
|||
#autoload
|
||||
|
||||
local expl nm="$compstate[nmatches]"
|
||||
# Complete user/host combinations. Normally this looks for the style
|
||||
# `users-hosts' for the tag `accounts'. A different tag may be given
|
||||
# with `-t tag'.
|
||||
# A `-' or `--' as the first argument is ignored.
|
||||
|
||||
if [[ -prefix 1 *@ ]]; then
|
||||
local user=${PREFIX/@}
|
||||
compset -P 1 '*@'
|
||||
_description expl "hostnames for $user"
|
||||
_combination accounts_users_hosts users="$user" hosts "$expl[@]" "$@"
|
||||
else
|
||||
_description expl "usernames"
|
||||
_combination accounts_users_hosts users -S@ -q "$expl[@]" "$@"
|
||||
local suf tag=accounts
|
||||
|
||||
if [[ "$1" = -t?* ]]; then
|
||||
tag="${1[3,-1]}"
|
||||
shift
|
||||
elif [[ "$1" = -t ]]; then
|
||||
tag="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
[[ nm -ne compstate[nmatches] ]]
|
||||
[[ "$1" = -(|-) ]] && shift
|
||||
|
||||
if [[ -prefix 1 *@ ]]; then
|
||||
local user=${PREFIX%%@*}
|
||||
|
||||
compset -P 1 '*@'
|
||||
|
||||
_wanted -C user-at hosts expl "host for $user" \
|
||||
_combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" -
|
||||
else
|
||||
compset -S '@*' || suf="@"
|
||||
_wanted users expl "user" \
|
||||
_combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" -
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue