mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
use of _arguments for completion of a couple more builtins (11615)
This commit is contained in:
parent
47532f255e
commit
24695d682f
3 changed files with 57 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,8 @@
|
|||
2000-05-28 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 11615: Completion/Builtins/_which, Completion/Builtins/_unhash:
|
||||
use of _arguments for completion of a couple more builtins
|
||||
|
||||
2000-05-27 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 11606: Src/parse.c, Test/01grammar.ztst: Propagate parse errors
|
||||
|
@ -31,7 +36,7 @@
|
|||
2000-05-25 Oliver Kiddle <opk@u.genie.co.uk>
|
||||
|
||||
* 11579: Completion/Builtins/_compdef, Completion/Builtins/_zpty:
|
||||
Split _arguments calls into sets to avoid long mutex lists
|
||||
split _arguments calls into sets to avoid long mutex lists
|
||||
|
||||
2000-05-25 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
|
@ -760,7 +765,7 @@
|
|||
|
||||
* 11184: Completion/User/.distfiles, Completion/User/_bzip2,
|
||||
Completion/User/_compress, Completion/User/_lzop,
|
||||
Completion/User/_pack, Completion/User/_zcat: Use one function for
|
||||
Completion/User/_pack, Completion/User/_zcat: use one function for
|
||||
each of compress/uncompress and pack/unpack and new lzop completion
|
||||
|
||||
2000-05-05 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
||||
|
@ -951,7 +956,7 @@
|
|||
2000-05-01 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 11041: Completion/User/.distfiles, Completion/User/_bzip2:
|
||||
Use of _arguments for bzip2 completion
|
||||
use of _arguments for bzip2 completion
|
||||
|
||||
* 11037: Etc/MACHINES, Etc/NEWS, Etc/completion-style-guide,
|
||||
Etc/zsh-development-guide: spelling corrections
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
#defcomp unhash
|
||||
#compdef unhash
|
||||
|
||||
[[ -mword 1 -*d* ]] && complist -n
|
||||
[[ -mword 1 -*a* ]] && complist -a
|
||||
[[ -mword 1 -*f* ]] && complist -F
|
||||
[[ ! -mword 1 -* ]] && complist -m
|
||||
local expl state line curcontext="$curcontext"
|
||||
|
||||
_arguments -C -s \
|
||||
'(-a -f *)-d[remove named directories]:*:named directory:->nameddir' \
|
||||
'(-d -f *)-a[remove aliases]:*:aliases:_aliases' \
|
||||
'(-d -a *)-f[remove functions]:*:functions:_functions' \
|
||||
'-m[treat arguments as patterns]' \
|
||||
'*:commands:_command_names -e' && return 0
|
||||
|
||||
if [[ "$state" = nameddir ]]; then
|
||||
_wanted nameddir expl 'named directory' compadd - ${(@k)nameddirs}
|
||||
fi
|
||||
|
|
|
@ -1,3 +1,37 @@
|
|||
#defcomp which whence where type
|
||||
#compdef which whence where type
|
||||
|
||||
complist -caF
|
||||
local farg aarg cargs args state line curcontext="$curcontext"
|
||||
|
||||
cargs=( \
|
||||
'(-v -c)-w[print command type]' \
|
||||
'-p[always do a path search]' \
|
||||
'-m[treat the arguments as patterns]' \
|
||||
'-s[print symlink free path as well]' \
|
||||
'*:commands:->command' )
|
||||
farg='-f[output contents of functions]'
|
||||
aarg='-a[print all occurences in path]'
|
||||
|
||||
case ${words[1]} in
|
||||
whence)
|
||||
_arguments -C -s \
|
||||
'(-c -w)-v[verbose output]' \
|
||||
'(-v -w)-c[csh-like output]' \
|
||||
"${cargs[@]}" "$farg" "$aarg" && return 0
|
||||
;;
|
||||
where) _arguments -C -s "${cargs[@]}" && return 0;;
|
||||
which) _arguments -C -s "${cargs[@]}" "$aarg" && return 0;;
|
||||
type) _arguments -C -s "${cargs[@]}" "$aarg" "$farg" && return 0;;
|
||||
esac
|
||||
|
||||
if [[ "$state" = command ]]; then
|
||||
|
||||
args=( "$@" )
|
||||
|
||||
_alternative -O args \
|
||||
'commands:external command:compadd - ${(k@)commands}' \
|
||||
'builtins:builtin command:compadd - ${(k@)builtins}' \
|
||||
'functions:shell function:compadd - ${(k@)functions}' \
|
||||
'aliases:alias:compadd - ${(k@)aliases}' \
|
||||
'reserved-words:reserved word:compadd - ${(k@)reswords}'
|
||||
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue