mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-12 13:21:15 +02:00
handle prefix-hidden style
This commit is contained in:
parent
93572c7bb6
commit
a8a7df84ed
2 changed files with 26 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-03-10 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 18331: Completion/Unix/Command/_mh: use _call_program to avoid
|
||||||
|
command not found errors, handle prefix-hidden style, make use of
|
||||||
|
_email_addresses and complete for more mh commands
|
||||||
|
|
||||||
2003-03-07 Peter Stephenson <pws@csr.com>
|
2003-03-07 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
* 18327: Completion/compinstall: add handling for preserve-prefix.
|
* 18327: Completion/compinstall: add handling for preserve-prefix.
|
||||||
|
|
|
@ -1,25 +1,30 @@
|
||||||
#compdef folder folders comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhlist mhstore mhshow mhparam mhmail
|
#compdef ali dist flist flists folder folders forw comp inc mark refile repl scan show next prev packf rmf rmm pick whom mhn mhpath mhlist mhstore mhshow mhparam mhmail
|
||||||
|
|
||||||
# Completion for all possible MH commands.
|
# Completion for all possible MH commands.
|
||||||
|
|
||||||
local mymhdir=${$(mhpath + 2>/dev/null):-~/Mail}
|
local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail}
|
||||||
local mhlib=/usr/lib/mh
|
local mhlib=/usr/lib/mh
|
||||||
|
|
||||||
local prev="$words[CURRENT-1]" expl
|
local prev="$words[CURRENT-1]" expl
|
||||||
|
|
||||||
# To be on the safe side, check this exists and if not, get it anyway.
|
|
||||||
[[ -d $mymhdir ]] || mymhdir=$(mhpath +)
|
|
||||||
|
|
||||||
if compset -P 1 -; then
|
if compset -P 1 -; then
|
||||||
# get list of options, which MH commands can generate themselves
|
# get list of options, which MH commands can generate themselves
|
||||||
# awk is just too icky to use for this, sorry. send me one if
|
# awk is just too icky to use for this, sorry. send me one if
|
||||||
# you come up with it.
|
# you come up with it.
|
||||||
_wanted options expl option \
|
local -a options disp
|
||||||
compadd - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) {
|
options=(
|
||||||
|
$($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) {
|
||||||
$n = $1;
|
$n = $1;
|
||||||
$n =~ s/\)//g;
|
$n =~ s/\)//g;
|
||||||
print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n";
|
print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n";
|
||||||
}')
|
}')
|
||||||
|
)
|
||||||
|
if zstyle -t ":completion:${curcontext}:options" prefix-hidden; then
|
||||||
|
_wanted options expl option compadd -d disp - "$options[@]"
|
||||||
|
else
|
||||||
|
disp=( -${options} )
|
||||||
|
_wanted options expl option compadd -d disp - "$options[@]"
|
||||||
|
fi
|
||||||
return
|
return
|
||||||
elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then
|
elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then
|
||||||
# Complete folder names.
|
# Complete folder names.
|
||||||
|
@ -46,6 +51,8 @@ elif [[ "$prev" = -(form|audit|filter) ]]; then
|
||||||
mhfpath=($mymhdir $mhlib)
|
mhfpath=($mymhdir $mhlib)
|
||||||
|
|
||||||
_wanted files expl 'MH template file' _files -W mhfpath -g '*(.)'
|
_wanted files expl 'MH template file' _files -W mhfpath -g '*(.)'
|
||||||
|
elif [[ $service = mhmail ]]; then
|
||||||
|
_email_addresses
|
||||||
elif [[ "$prev" = -(no|)cc ]]; then
|
elif [[ "$prev" = -(no|)cc ]]; then
|
||||||
_wanted -C "$prev" values expl 'CC address' compadd all to cc me
|
_wanted -C "$prev" values expl 'CC address' compadd all to cc me
|
||||||
elif [[ "$prev" = -[rw]cache ]]; then
|
elif [[ "$prev" = -[rw]cache ]]; then
|
||||||
|
@ -53,8 +60,8 @@ elif [[ "$prev" = -[rw]cache ]]; then
|
||||||
elif [[ $service = mhparam ]]; then
|
elif [[ $service = mhparam ]]; then
|
||||||
_wanted parameters expl 'MH parameter' compadd - \
|
_wanted parameters expl 'MH parameter' compadd - \
|
||||||
${${(f)"$(mhparam -all)"}%%:*}
|
${${(f)"$(mhparam -all)"}%%:*}
|
||||||
elif [[ $service = mhmail ]]; then
|
elif [[ $service = ali ]]; then
|
||||||
_user_at_host
|
_email_addresses -n MH
|
||||||
else
|
else
|
||||||
# Generate sequences.
|
# Generate sequences.
|
||||||
local foldnam folddir f ret
|
local foldnam folddir f ret
|
||||||
|
|
Loading…
Reference in a new issue