diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2003-03-10 15:16:27 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2003-03-10 15:16:27 +0000 |
commit | a8a7df84edbd9b5fb2b8076dabd3bea59ea30b61 (patch) | |
tree | 596a8ca3ee3eb185bd8d7a22e9cc18690aff9730 | |
parent | 93572c7bb69e0923377066a323c4654f2c7b3028 (diff) | |
download | zsh-a8a7df84edbd9b5fb2b8076dabd3bea59ea30b61.tar.gz zsh-a8a7df84edbd9b5fb2b8076dabd3bea59ea30b61.tar.xz zsh-a8a7df84edbd9b5fb2b8076dabd3bea59ea30b61.zip |
handle prefix-hidden style
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Completion/Unix/Command/_mh | 33 |
2 files changed, 26 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog index cfacc0231..bf11b56dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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> * 18327: Completion/compinstall: add handling for preserve-prefix. diff --git a/Completion/Unix/Command/_mh b/Completion/Unix/Command/_mh index 76ef0fa5c..d25870281 100644 --- a/Completion/Unix/Command/_mh +++ b/Completion/Unix/Command/_mh @@ -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. -local mymhdir=${$(mhpath + 2>/dev/null):-~/Mail} +local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail} local mhlib=/usr/lib/mh 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 # get list of options, which MH commands can generate themselves # awk is just too icky to use for this, sorry. send me one if # you come up with it. - _wanted options expl option \ - compadd - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { - $n = $1; - $n =~ s/\)//g; - print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; - }') + local -a options disp + options=( + $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { + $n = $1; + $n =~ s/\)//g; + 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 elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then # Complete folder names. @@ -46,6 +51,8 @@ elif [[ "$prev" = -(form|audit|filter) ]]; then mhfpath=($mymhdir $mhlib) _wanted files expl 'MH template file' _files -W mhfpath -g '*(.)' +elif [[ $service = mhmail ]]; then + _email_addresses elif [[ "$prev" = -(no|)cc ]]; then _wanted -C "$prev" values expl 'CC address' compadd all to cc me elif [[ "$prev" = -[rw]cache ]]; then @@ -53,8 +60,8 @@ elif [[ "$prev" = -[rw]cache ]]; then elif [[ $service = mhparam ]]; then _wanted parameters expl 'MH parameter' compadd - \ ${${(f)"$(mhparam -all)"}%%:*} -elif [[ $service = mhmail ]]; then - _user_at_host +elif [[ $service = ali ]]; then + _email_addresses -n MH else # Generate sequences. local foldnam folddir f ret |