From 5385a822b6de0fc5a805dfe99f78bdafdd476736 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 17 Jan 2003 09:23:34 +0000 Subject: 18121: add new function for completing e-mail addresses --- Completion/Unix/Command/_elm | 21 +++------------- Completion/Unix/Command/_mail | 21 +++------------- Completion/Unix/Command/_mutt | 58 ++++++++++++++++--------------------------- Completion/Unix/Command/_pine | 32 ++++-------------------- 4 files changed, 32 insertions(+), 100 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/_elm b/Completion/Unix/Command/_elm index 34a30649c..2918a5de0 100644 --- a/Completion/Unix/Command/_elm +++ b/Completion/Unix/Command/_elm @@ -1,9 +1,7 @@ #compdef elm -local curcontext="$curcontext" state line expl suf - -_arguments -C -s \ - '::recipient:->userhost' \ +_arguments -s \ + '::recipient:_email_addresses' \ '-a[use the arrow pointer regardless]' \ '-A+[attach file]:file attachment:_files' \ '-c[check the given aliases only]:*:alias' \ @@ -17,17 +15,4 @@ _arguments -C -s \ '-V[enable sendmail voyeur mode]' \ '-v[display elm version]' \ '-w[write .elm/elmrc]' \ - '-z[start only if new messages]' && return 0 - -if [[ "$state" = userhost ]]; then - if compset -P '*@'; then - _description hosts expl 'remote host name' - _hosts "$expl[@]" && return 0 - else - compset -S '@*' || suf='@' - _description users expl 'login name' - _users "$expl[@]" -q -S "$suf" && return 0 - fi -fi - -return 1 + '-z[start only if new messages]' diff --git a/Completion/Unix/Command/_mail b/Completion/Unix/Command/_mail index 82a3a59d0..90c75359d 100644 --- a/Completion/Unix/Command/_mail +++ b/Completion/Unix/Command/_mail @@ -1,24 +1,9 @@ -#compdef mail mailx Mail mush zmail nail +#compdef mail mailx=mail Mail=mail mush zmail nail=mail -local curcontext="$curcontext" state line expl suf - -_arguments -C -s \ +_arguments -s \ '(-f -u)*-b[specify a BCC recipient]:BCC recipient:->userhost' \ '(-f -u)*-c[specify a CC recipient]:CC recipient:->userhost' \ '(-b -c -u -s *)-f+[specify mail folder]:mailbox:_mailboxes' \ '(-f -u)-s+[specify a subject]:subject:' \ "(-b -c -f -s *)-u+[read specified user's mail]:user:_users" \ - '(-f -u)*:recipient:->userhost' && return 0 - -if [[ "$state" = userhost ]]; then - if compset -P '*@'; then - _description hosts expl 'remote host name' - _hosts "$expl[@]" && return 0 - else - compset -S '@*' || suf='@' - _description users expl 'login name' - _users "$expl[@]" -q -S "$suf" && return 0 - fi -fi - -return 1 + "(-f -u)*:recipient:_email_addresses -n $service" diff --git a/Completion/Unix/Command/_mutt b/Completion/Unix/Command/_mutt index 21e383484..c9ff98af4 100644 --- a/Completion/Unix/Command/_mutt +++ b/Completion/Unix/Command/_mutt @@ -1,39 +1,23 @@ #compdef mutt -local curcontext="$curcontext" state line expl suf -typeset -A opt_args - -_arguments -C -s \ - '::recipient:->userhost' \ - '*-a[attach file using MIME]:file attachment:_files' \ - '*-b[specify a BCC recipient]:BCC recipient:->userhost' \ - '*-c[specify a CC recipient]:CC recipient:->userhost' \ - '-e+[specify a post-init configuration command]:post-init configuration:' \ - '-f+[specify mailbox to load]:mailbox: _mailboxes' \ - '-F+[specify an init file]:init file:_files' \ - '-h[display help]' \ - '-H+[specify a draft file for message]:draft file:_files' \ - '-i+[specify file to include in message]:include file:_files' \ - '-m+[specify default mailbox type]:mailbox type:(mbox MMDF MH Maildir)' \ - '-n[bypass system configuration]' \ - '-p[resume postponed message]' \ - '-R[open in read-only mode]' \ - '-s+[specify a subject]:subject:' \ - '-v[display mutt version]' \ - '-x[emulate mailx compose]' \ - '-y[start listing mailboxes]' \ - '-z[start only if new messages]' \ - '-Z[open first mailbox with new mail]' && return 0 - -if [[ "$state" = userhost ]]; then - if compset -P '*@'; then - _description hosts expl 'remote host name' - _hosts "$expl[@]" -q -S, && return 0 - else - compset -S '@*' || suf='@' - _description users expl 'login name' - _users "$expl[@]" -q -S "$suf" && return 0 - fi -fi - -return 1 +_arguments -s \ + '::recipient:_email_addresses -n mutt' \ + '*-a[attach file using MIME]:file attachment:_files' \ + '*-b[specify a BCC recipient]:BCC recipient:_email_addresses -n mutt' \ + '*-c[specify a CC recipient]:CC recipient:_email_addresses -n mutt' \ + '-e+[specify a post-init configuration command]:post-init configuration:' \ + '-f+[specify mailbox to load]:mailbox: _mailboxes' \ + '-F+[specify an init file]:init file:_files' \ + '-h[display help]' \ + '-H+[specify a draft file for message]:draft file:_files' \ + '-i+[specify file to include in message]:include file:_files' \ + '-m+[specify default mailbox type]:mailbox type:(mbox MMDF MH Maildir)' \ + '-n[bypass system configuration]' \ + '-p[resume postponed message]' \ + '-R[open in read-only mode]' \ + '-s+[specify a subject]:subject:' \ + '-v[display mutt version]' \ + '-x[emulate mailx compose]' \ + '-y[start listing mailboxes]' \ + '-z[start only if new messages]' \ + '-Z[open first mailbox with new mail]' diff --git a/Completion/Unix/Command/_pine b/Completion/Unix/Command/_pine index 9ee0b44c9..1902074a8 100644 --- a/Completion/Unix/Command/_pine +++ b/Completion/Unix/Command/_pine @@ -1,9 +1,8 @@ #compdef pine pinef -local curcontext="$curcontext" state line expl suf local optfile getopts='pine -conf' sortorder lusortorder opts send idx -if [[ -n $+_cache_pine_options ]]; then +if (( $#_cache_pine_options )); then for optfile in ~/.pinerc /etc/pine.conf; do if [[ -f $optfile ]]; then getopts="cat $optfile" @@ -20,7 +19,7 @@ opts=( -h -v -F -conf -create_lu -pinerc -copy_abook -copy_pinerc) # exclusive idx=( -f -c -i -I -n -o -sort ) # options used when viewing messages send=( -attach -attachlist -attach_and_delete -url ) # options when sending -_arguments -C -s \ +_arguments -s \ "($opts $idx $send -bail -d -k -z -r -p -P *)-h[display help]" \ "($opts $idx $send -bail -d -k -z -r -p -P *)-v[display version information]" \ "($opts $idx $send -r *)-F+[specify file to open and page through]:file:_files" \ @@ -32,7 +31,7 @@ _arguments -C -s \ "($opts $idx -url)-attach[go directly into composer with given file]:file:_files" \ "($opts $idx -url)-attachlist[go to composer with given files]:file:_files" \ "($opts $idx -url)-attach_and_delete[go to composer, attach file, delete when finished]:file:_files" \ - "($opts $idx $send)-url[open the given URL]:url:->url" \ + "($opts $idx $send)-url[open the given URL]:url:_email_addresses -c -P mailto\:" \ "($opts $send)-f+[specify mailbox to load]:mailbox: _mailboxes" \ "($opts $send)-c+[specify context to apply to -f arg]: :_guard '[0-9]#' number" \ "($opts $send)-sort[specify sort order of folder]:sort order:(${(j: :)sortorder})" \ @@ -48,26 +47,5 @@ _arguments -C -s \ \(${(j. .)opts:#-F}')-P+[use alternate pine.conf file]:alternate pine.conf:_files' \ \(${(j. .)opts:#-F}')-x[use configuration exceptions file]:configuration exceptions file:_files' \ \(${(j. .)opts:#-F}")-bail[exit if pinerc file doesn't already exist]" \ - '*::recipient:->userhost' \ - ${^_cache_pine_options}':option value' && return 0 - -if [[ "$state" = url ]]; then - if compset -P 'mailto:'; then - state=userhost - else - compadd -S: mailto && return 0 - fi -fi - -if [[ "$state" = userhost ]]; then - if compset -P '*@'; then - _description hosts expl 'remote host name' - _hosts "$expl[@]" && return 0 - else - compset -S '@*' || suf='@' - _description users expl 'login name' - _users "$expl[@]" -q -S "$suf" && return 0 - fi -fi - -return 1 + '*::recipient:_email_addresses -n pine' \ + ${^_cache_pine_options}':option value' -- cgit 1.4.1